Пример #1
0
 function let(\Widget $widget)
 {
     $widget->getErrors()->willReturn(array());
     $this->beConstructedWith($widget);
     if (!class_exists('FrontendTemplate', false)) {
         class_alias('spec\\Netzmacht\\Contao\\FormHelper\\FrontendTemplate', 'FrontendTemplate');
     }
     if (!isset($GLOBALS['TL_FFL'])) {
         $GLOBALS['TL_FFL'] = array();
     }
 }
Пример #2
0
 function it_creates_a_view(\Widget $widget, EventDispatcher $eventDispatcher)
 {
     $widget->getErrors()->willReturn(array());
     $eventDispatcher->dispatch(Events::CREATE_VIEW, Argument::type(self::VIEW_EVENT_CLASS))->shouldBeCalled();
     $eventDispatcher->dispatch(Events::CREATE_ELEMENT, Argument::type(self::CREATE_ELEMENT_EVENT_CLASS))->will(function ($args) {
         /** @var CreateElementEvent $event */
         $event = $args[1];
         $event->setElement(new Node('input'));
     });
     $eventDispatcher->dispatch(Events::PRE_GENERATE_VIEW, Argument::type(self::VIEW_EVENT_CLASS))->shouldBeCalled();
     $eventDispatcher->dispatch(Events::GENERATE_VIEW, Argument::type(self::VIEW_EVENT_CLASS))->shouldBeCalled();
     $this->createView($widget)->shouldBeAnInstanceOf(self::VIEW_CLASS);
 }
Пример #3
0
 /**
  * Construct.
  *
  * @param \Widget    $widget    The form widget.
  * @param \FormModel $formModel Optional the corresponding form model.
  */
 public function __construct(\Widget $widget, \FormModel $formModel = null)
 {
     $this->widget = $widget;
     $this->formModel = $formModel;
     $this->attributes = new Attributes();
     $this->container = new Container();
     $this->label = new Label();
     $this->errors = new Errors($widget->getErrors());
     $this->widgetType = WidgetUtil::getType($widget);
 }