8000 Introduce failing test case when a SplFileInfo object is passed to th… · symfony/symfony@aa7cbbd · GitHub
[go: up one dir, main page]

Skip to content

Commit aa7cbbd

Browse files
marcosdsanchezxabbuh
authored andcommitted
Introduce failing test case when a SplFileInfo object is passed to the extract() method in the TwigExtractor.
The problem is that when there's a twig error, symfony expects the `getRelativePath` method that the native object doesn't have.
1 parent 38b9a88 commit aa7cbbd

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,26 @@ public function getExtractData()
7474
/**
7575
* @expectedException \Twig_Error
7676
* @expectedExceptionMessageRegExp /Unclosed "block" in "extractor(\/|\\)syntax_error\.twig" at line 1/
77+
* @dataProvider resourcesWithSyntaxErrorsProvider
7778
*/
78-
public function testExtractSyntaxError()
79+
public function testExtractSyntaxError($resources)
7980
{
8081
$twig = new \Twig_Environment(new \Twig_Loader_Array(array()));
8182
$twig->addExtension(new TranslationExtension($this->getMock('Symfony\Component\Translation\TranslatorInterface')));
8283

8384
$extractor = new TwigExtractor($twig);
84-
$extractor->extract(__DIR__.'/../Fixtures', new MessageCatalogue('en'));
85+
$extractor->extract($resources, new MessageCatalogue('en'));
86+
}
87+
88+
/**
89+
* @return array
90+
*/
91+
public function resourcesWithSyntaxErrorsProvider()
92+
{
93+
return array(
94+
array(__DIR__.'/../Fixtures'),
95+
array(new \SplFileInfo(__DIR__.'/../Fixtures/extractor/syntax_error.twig')),
96+
);
8597
}
8698

8799
/**

0 commit comments

Comments
 (0)
0