Skip to content

Commit

Permalink
[TwigBridge] fixed Twig_Source required argument
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Oct 22, 2016
1 parent 8974d77 commit b9a4586
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Expand Up @@ -23,7 +23,7 @@ public function testEscaping($template, $mustBeEscaped)
$twig = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('debug' => true, 'cache' => false, 'autoescape' => 'html', 'optimizations' => 0));
$twig->addExtension(new RoutingExtension($this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface')));

$nodes = $twig->parse($twig->tokenize(new \Twig_Source($template)));
$nodes = $twig->parse($twig->tokenize(new \Twig_Source($template, '')));

$this->assertSame($mustBeEscaped, $nodes->getNode('body')->getNode(0)->getNode('expr') instanceof \Twig_Node_Expression_Filter);
}
Expand Down
Expand Up @@ -25,7 +25,7 @@ public static function getModule($content)
new \Twig_Node_Expression_Array(array(), 0),
new \Twig_Node_Expression_Array(array(), 0),
null,
new \Twig_Source('')
new \Twig_Source('', '')
);
}

Expand Down
Expand Up @@ -23,7 +23,7 @@ public function testCompile($source, $expected)
{
$env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0));
$env->addTokenParser(new FormThemeTokenParser());
$stream = $env->tokenize(new \Twig_Source($source));
$stream = $env->tokenize(new \Twig_Source($source, ''));
$parser = new \Twig_Parser($env);

$this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0));
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Translation/TwigExtractor.php
Expand Up @@ -85,7 +85,7 @@ protected function extractTemplate($template, MessageCatalogue $catalogue)
$visitor = $this->twig->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->getTranslationNodeVisitor();
$visitor->enable();

$this->twig->parse($this->twig->tokenize(new \Twig_Source($template)));
$this->twig->parse($this->twig->tokenize(new \Twig_Source($template, '')));

foreach ($visitor->getMessages() as $message) {
$catalogue->set(trim($message[0]), $this->prefix.trim($message[0]), $message[1] ?: $this->defaultDomain);
Expand Down

0 comments on commit b9a4586

Please sign in to comment.