Server IP : 66.29.132.122 / Your IP : 18.220.6.168 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/opt/alt/php55/usr/share/pear/test/TwigBridge/Symfony/Bridge/Twig/Tests/Extension/ |
Upload File : |
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig\Tests\Extension; use Symfony\Component\Form\FormView; use Symfony\Bridge\Twig\Form\TwigRenderer; use Symfony\Bridge\Twig\Form\TwigRendererEngine; use Symfony\Bridge\Twig\Extension\FormExtension; use Symfony\Bridge\Twig\Extension\TranslationExtension; use Symfony\Component\Form\Tests\AbstractTableLayoutTest; use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator; use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader; class FormExtensionTableLayoutTest extends AbstractTableLayoutTest { /** * @var FormExtension */ protected $extension; protected function setUp() { parent::setUp(); $rendererEngine = new TwigRendererEngine(array( 'form_table_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 tearDown() { parent::tearDown(); $this->extension = null; } protected function renderForm(FormView $view, array $vars = array()) { return (string) $this->extension->renderer->renderBlock($view, 'form', $vars); } protected function renderEnctype(FormView $view) { return (string) $this->extension->renderer->searchAndRenderBlock($view, 'enctype'); } protected function renderLabel(FormView $view, $label = null, array $vars = array()) { if ($label !== null) { $vars += array('label' => $label); } return (string) $this->extension->renderer->searchAndRenderBlock($view, 'label', $vars); } protected function renderErrors(FormView $view) { return (string) $this->extension->renderer->searchAndRenderBlock($view, 'errors'); } protected function renderWidget(FormView $view, array $vars = array()) { return (string) $this->extension->renderer->searchAndRenderBlock($view, 'widget', $vars); } protected function renderRow(FormView $view, array $vars = array()) { return (string) $this->extension->renderer->searchAndRenderBlock($view, 'row', $vars); } protected function renderRest(FormView $view, array $vars = array()) { return (string) $this->extension->renderer->searchAndRenderBlock($view, 'rest', $vars); } protected function renderStart(FormView $view, array $vars = array()) { return (string) $this->extension->renderer->renderBlock($view, 'form_start', $vars); } protected function renderEnd(FormView $view, array $vars = array()) { return (string) $this->extension->renderer->renderBlock($view, 'form_end', $vars); } protected function setTheme(FormView $view, array $themes) { $this->extension->renderer->setTheme($view, $themes); } }