@@ -78,23 +78,15 @@ public function getExtractData()
78
78
/**
79
79
* @dataProvider resourcesWithSyntaxErrorsProvider
80
80
*/
81
- public function testExtractSyntaxError ($ resources )
81
+ public function testExtractSyntaxError ($ resources, array $ messages )
82
82
{
83
- $ this ->expectException ('Twig\Error\Error ' );
84
83
$ twig = new Environment ($ this ->getMockBuilder ('Twig\Loader\LoaderInterface ' )->getMock ());
85
84
$ twig ->addExtension (new TranslationExtension ($ this ->getMockBuilder ('Symfony\Component\Translation\TranslatorInterface ' )->getMock ()));
86
85
87
86
$ extractor = new TwigExtractor ($ twig );
88
-
89
- try {
90
- $ extractor ->extract ($ resources , new MessageCatalogue ('en ' ));
91
- } catch (Error $ e ) {
92
- $ this ->assertSame (\dirname (__DIR__ ).strtr ('/Fixtures/extractor/syntax_error.twig ' , '/ ' , \DIRECTORY_SEPARATOR ), $ e ->getFile ());
93
- $ this ->assertSame (1 , $ e ->getLine ());
94
- $ this ->assertSame ('Unclosed "block". ' , $ e ->getMessage ());
95
-
96
- throw $ e ;
97
- }
87
+ $ catalogue = new MessageCatalogue ('en ' );
88
+ $ extractor ->extract ($ resources , $ catalogue );
89
+ $ this ->assertSame ($ messages , $ catalogue ->all ());
98
90
}
99
91
100
92
/**
@@ -103,9 +95,9 @@ public function testExtractSyntaxError($resources)
103
95
public function resourcesWithSyntaxErrorsProvider ()
104
96
{
105
97
return [
106
- [__DIR__ .'/../Fixtures ' ],
107
- [__DIR__ .'/../Fixtures/extractor/syntax_error.twig ' ],
108
- [new \SplFileInfo (__DIR__ .'/../Fixtures/extractor/syntax_error.twig ' )],
98
+ [__DIR__ .'/../Fixtures ' , [ ' messages ' => [ ' Hi! ' => ' Hi! ' ]] ],
99
+ [__DIR__ .'/../Fixtures/extractor/syntax_error.twig ' , [] ],
100
+ [new \SplFileInfo (__DIR__ .'/../Fixtures/extractor/syntax_error.twig ' ), [] ],
109
101
];
110
102
}
111
103
0 commit comments