This commit is contained in:
Fabien Potencier 2014-04-28 11:30:24 +02:00
parent 11f9497e50
commit 17d7186cf8
2 changed files with 3 additions and 7 deletions

View File

@ -36,7 +36,7 @@ class TransNode extends \Twig_Node
$defaults = $this->getNode('vars');
$vars = null;
}
list($msg, $defaults) = $this->compileString($this->getNode('body'), $defaults, (boolean) $vars);
list($msg, $defaults) = $this->compileString($this->getNode('body'), $defaults, (bool) $vars);
$method = null === $this->getNode('count') ? 'trans' : 'transChoice';

View File

@ -14,22 +14,17 @@ namespace Symfony\Bridge\Twig\Tests\Node;
use Symfony\Bridge\Twig\Node\TransNode;
/**
*
* @author Asmir Mustafic <goetas@gmail.com>
*
*/
class TransNodeTest extends \PHPUnit_Framework_TestCase
{
public function testCompileStrict()
{
$body = new \Twig_Node_Text('trans %var%', 0);
$vars = new \Twig_Node_Expression_Name('foo', 0);
$node = new TransNode($body, null, null, $vars);
$env = new \Twig_Environment(null, array(
'strict_variables' => true,
));
$env = new \Twig_Environment(null, array('strict_variables' => true));
$compiler = new \Twig_Compiler($env);
$this->assertEquals(
@ -49,6 +44,7 @@ class TransNodeTest extends \PHPUnit_Framework_TestCase
return sprintf('$this->getContext($context, "%s", true)', $name);
}
protected function getVariableGetterWithStrictCheck($name)
{
if (version_compare(phpversion(), '5.4.0RC1', '>=')) {