Set the widget registry the helper will use.
public widgetRegistry ( Cake\View\Widget\WidgetRegistry $instance = null, array $widgets = [] ) : Cake\View\Widget\WidgetRegistry | ||
$instance | Cake\View\Widget\WidgetRegistry | The registry instance to set. |
$widgets | array | An array of widgets |
return | Cake\View\Widget\WidgetRegistry |
/** * Test that when specifying custom widgets config file and it should be * added to widgets array. WidgetRegistry will load widgets in constructor. * * @return void */ public function testConstructWithWidgetsConfig() { $helper = new FormHelper($this->View, ['widgets' => ['test_widgets']]); $registry = $helper->widgetRegistry(); $this->assertInstanceOf('Cake\\View\\Widget\\LabelWidget', $registry->get('text')); }