protected function setUp()
 {
     if (!class_exists('Symfony\\Component\\Locale\\Locale')) {
         $this->markTestSkipped('The "Locale" component is not available');
     }
     if (!class_exists('Symfony\\Component\\EventDispatcher\\EventDispatcher')) {
         $this->markTestSkipped('The "EventDispatcher" component is not available');
     }
     if (!class_exists('Symfony\\Component\\Form\\Form')) {
         $this->markTestSkipped('The "Form" component is not available');
     }
     if (!class_exists('Twig_Environment')) {
         $this->markTestSkipped('Twig is not available.');
     }
     parent::setUp();
     $rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig', 'custom_widgets.html.twig'));
     $renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\\Component\\Form\\Extension\\Csrf\\CsrfProvider\\CsrfProviderInterface'));
     $this->extension = new FormExtension($renderer);
     $loader = new StubFilesystemLoader(array(__DIR__ . '/../../Resources/views/Form', __DIR__));
     $environment = new \Twig_Environment($loader, array('strict_variables' => true));
     $environment->addExtension(new TranslationExtension(new StubTranslator()));
     $environment->addGlobal('global', '');
     $environment->addExtension($this->extension);
     $this->extension->initRuntime($environment);
 }
 protected function setUp()
 {
     if (!class_exists('Symfony\\Bundle\\FrameworkBundle\\Templating\\Helper\\TranslatorHelper')) {
         $this->markTestSkipped('The "FrameworkBundle" is not available');
     }
     if (!class_exists('Symfony\\Component\\Templating\\PhpEngine')) {
         $this->markTestSkipped('The "Templating" component is not available');
     }
     parent::setUp();
 }
 protected function setUp()
 {
     parent::setUp();
     $root = realpath(__DIR__ . '/../../../Resources/views');
     $rootTheme = realpath(__DIR__ . '/Resources');
     $templateNameParser = new StubTemplateNameParser($root, $rootTheme);
     $loader = new FilesystemLoader(array());
     $engine = new PhpEngine($templateNameParser, $loader);
     $this->helper = new FormHelper($engine, $this->getMock('Symfony\\Component\\Form\\Extension\\Csrf\\CsrfProvider\\CsrfProviderInterface'), array('FrameworkBundle:Form'));
     $engine->setHelpers(array($this->helper, new TranslatorHelper(new StubTranslator())));
 }
 protected function setUp()
 {
     parent::setUp();
     $loader = new StubFilesystemLoader(array(__DIR__ . '/../../Resources/views/Form', __DIR__ . '/Fixtures/templates/form'));
     $environment = new \Twig_Environment($loader, array('strict_variables' => true));
     $environment->addExtension(new TranslationExtension(new StubTranslator()));
     $environment->addGlobal('global', '');
     // the value can be any template that exists
     $environment->addGlobal('dynamic_template_name', 'child_label');
     $environment->addExtension(new FormExtension());
     $rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig', 'custom_widgets.html.twig'), $environment);
     $this->renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface'));
     $this->registerTwigRuntimeLoader($environment, $this->renderer);
 }