2011-04-14 02:38:19 +01:00
|
|
|
<?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\Tests\Bridge\Twig\Extension;
|
|
|
|
|
|
|
|
require_once __DIR__.'/Fixtures/StubTranslator.php';
|
2011-04-14 12:46:11 +01:00
|
|
|
require_once __DIR__.'/Fixtures/StubFilesystemLoader.php';
|
2011-04-14 02:38:19 +01:00
|
|
|
|
2011-04-14 13:42:17 +01:00
|
|
|
use Symfony\Component\Form\TemplateContext;
|
2011-04-14 02:38:19 +01:00
|
|
|
use Symfony\Bridge\Twig\Extension\FormExtension;
|
|
|
|
use Symfony\Bridge\Twig\Extension\TranslationExtension;
|
|
|
|
use Symfony\Tests\Component\Form\AbstractTableLayoutTest;
|
|
|
|
use Symfony\Tests\Bridge\Twig\Extension\Fixtures\StubTranslator;
|
2011-04-14 12:46:11 +01:00
|
|
|
use Symfony\Tests\Bridge\Twig\Extension\Fixtures\StubFilesystemLoader;
|
2011-04-14 02:38:19 +01:00
|
|
|
|
|
|
|
class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
|
|
|
|
{
|
|
|
|
protected function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
2011-04-14 12:46:11 +01:00
|
|
|
$loader = new StubFilesystemLoader(array(
|
2011-04-14 02:38:19 +01:00
|
|
|
__DIR__.'/../../../../../../src/Symfony/Bundle/TwigBundle/Resources/views',
|
|
|
|
));
|
|
|
|
|
|
|
|
$this->extension = new FormExtension(array('table_layout.html.twig'));
|
|
|
|
|
|
|
|
$environment = new \Twig_Environment($loader);
|
|
|
|
$environment->addExtension($this->extension);
|
|
|
|
$environment->addExtension(new TranslationExtension(new StubTranslator()));
|
|
|
|
|
|
|
|
$this->extension->initRuntime($environment);
|
|
|
|
}
|
|
|
|
|
2011-04-14 13:42:17 +01:00
|
|
|
protected function renderEnctype(TemplateContext $context)
|
2011-04-14 02:38:19 +01:00
|
|
|
{
|
2011-04-14 13:42:17 +01:00
|
|
|
return (string)$this->extension->renderEnctype($context);
|
2011-04-14 02:38:19 +01:00
|
|
|
}
|
|
|
|
|
2011-04-14 13:42:17 +01:00
|
|
|
protected function renderLabel(TemplateContext $context, $label = null)
|
2011-04-14 02:38:19 +01:00
|
|
|
{
|
2011-04-14 13:42:17 +01:00
|
|
|
return (string)$this->extension->renderLabel($context, $label);
|
2011-04-14 02:38:19 +01:00
|
|
|
}
|
|
|
|
|
2011-04-14 13:42:17 +01:00
|
|
|
protected function renderErrors(TemplateContext $context)
|
2011-04-14 02:38:19 +01:00
|
|
|
{
|
2011-04-14 13:42:17 +01:00
|
|
|
return (string)$this->extension->renderErrors($context);
|
2011-04-14 02:38:19 +01:00
|
|
|
}
|
|
|
|
|
2011-04-14 13:42:17 +01:00
|
|
|
protected function renderWidget(TemplateContext $context, array $vars = array())
|
2011-04-14 02:38:19 +01:00
|
|
|
{
|
2011-04-14 13:42:17 +01:00
|
|
|
return (string)$this->extension->renderWidget($context, $vars);
|
2011-04-14 02:38:19 +01:00
|
|
|
}
|
|
|
|
|
2011-04-14 13:42:17 +01:00
|
|
|
protected function renderRow(TemplateContext $context, array $vars = array())
|
2011-04-14 02:38:19 +01:00
|
|
|
{
|
2011-04-14 13:42:17 +01:00
|
|
|
return (string)$this->extension->renderRow($context, $vars);
|
2011-04-14 02:38:19 +01:00
|
|
|
}
|
|
|
|
|
2011-04-14 13:42:17 +01:00
|
|
|
protected function renderRest(TemplateContext $context, array $vars = array())
|
2011-04-14 02:38:19 +01:00
|
|
|
{
|
2011-04-14 13:42:17 +01:00
|
|
|
return (string)$this->extension->renderRest($context, $vars);
|
2011-04-14 02:38:19 +01:00
|
|
|
}
|
|
|
|
}
|