[TwigBundle] added a test
This commit is contained in:
parent
b1bffc0516
commit
97a8f7e395
@ -78,4 +78,17 @@ class TwigExtractorTest extends TestCase
|
||||
array('{{ "new key" | transchoice(domain="domain", count=1) }}', array('new key' => 'domain')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Twig_Error
|
||||
* @expectedExceptionMessage Unclosed "block" in "extractor/syntax_error.twig" at line 1
|
||||
*/
|
||||
public function testExtractSyntaxError()
|
||||
{
|
||||
$twig = new \Twig_Environment(new \Twig_Loader_Array(array()));
|
||||
$twig->addExtension(new TranslationExtension($this->getMock('Symfony\Component\Translation\TranslatorInterface')));
|
||||
|
||||
$extractor = new TwigExtractor($twig);
|
||||
$extractor->extract(__DIR__.'/../Fixtures', new MessageCatalogue('en'));
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,8 @@ class TwigExtractor implements ExtractorInterface
|
||||
try {
|
||||
$this->extractTemplate(file_get_contents($file->getPathname()), $catalogue);
|
||||
} catch (\Twig_Error $e) {
|
||||
$e->setTemplateFile($file->getPathname());
|
||||
$e->setTemplateFile($file->getRelativePathname());
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user