Ejemplo n.º 1
0
 protected function setUp()
 {
     $this->controller = $controller = $this->getMock("Thelia\\Controller\\BaseController", ["getParser", "render", "renderRaw"]);
     /**
      * Reset static :: $formDefinition on controllers
      */
     $this->definitionReflection = $reflection = (new \ReflectionObject($this->controller))->getProperty('formDefinition');
     $reflection->setAccessible(true);
     $this->formDefinition = $reflection->getValue();
     $reflection->setValue(null);
     /**
      * Add the test type to the factory and
      * the form to the container
      */
     $factory = new FormFactoryBuilder();
     $factory->addExtension(new CoreExtension());
     $factory->addType(new TestType());
     /**
      * Construct the container
      */
     $container = new Container();
     $container->set("thelia.form_factory_builder", $factory);
     $container->set("thelia.translator", new Translator($container));
     $container->setParameter("thelia.parser.forms", array("test_form" => "Thelia\\Tests\\Resources\\Form\\TestForm"));
     $request = new Request();
     $request->setSession(new Session(new MockArraySessionStorage()));
     $container->set("request", $request);
     $container->set("thelia.forms.validator_builder", new ValidatorBuilder());
     $container->set("event_dispatcher", new EventDispatcher());
     $this->controller->setContainer($container);
 }
Ejemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     $this->controller = $this->getController();
     $this->controller->setContainer($this->container);
 }