コード例 #1
0
 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', 'FrameworkBundle:FormTable'));
     $engine->setHelpers(array($this->helper, new TranslatorHelper(new StubTranslator())));
 }
コード例 #2
0
 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', '');
     $environment->addExtension(new FormExtension());
     $rendererEngine = new TwigRendererEngine(array('form_table_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);
 }
コード例 #3
0
 protected function getExtensions()
 {
     // should be moved to the Form component once absolute file paths are supported
     // by the default name parser in the Templating component
     $reflClass = new \ReflectionClass('Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle');
     $root = realpath(dirname($reflClass->getFileName()) . '/Resources/views');
     $rootTheme = realpath(__DIR__ . '/Resources');
     $templateNameParser = new StubTemplateNameParser($root, $rootTheme);
     $loader = new FilesystemLoader(array());
     $this->engine = new PhpEngine($templateNameParser, $loader);
     $this->engine->addGlobal('global', '');
     $this->engine->setHelpers(array(new TranslatorHelper(new StubTranslator())));
     return array_merge(parent::getExtensions(), array(new TemplatingExtension($this->engine, $this->csrfProvider, array('FrameworkBundle:Form', 'FrameworkBundle:FormTable'))));
 }
コード例 #4
0
 protected function tearDown()
 {
     $this->engine = null;
     parent::tearDown();
 }
コード例 #5
0
 protected function tearDown()
 {
     parent::tearDown();
     $this->extension = null;
 }