Total Complexity | 2 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class JsExtractorTest extends TestCase |
||
10 | { |
||
11 | /** |
||
12 | * @dataProvider providePaths |
||
13 | */ |
||
14 | public function testExtraction(string $path) |
||
15 | { |
||
16 | $extractor = new JsExtractor(array($path), 'js'); |
||
17 | $catalogue = new MessageCatalogue('en'); |
||
18 | |||
19 | $extractor->extract($catalogue); |
||
20 | |||
21 | $expected = array( |
||
22 | 'js' => array( |
||
23 | 'test.single_quote', |
||
24 | 'test.double_quote', |
||
25 | 'choose.single_quote', |
||
26 | 'choose.double_quote', |
||
27 | 'test.single_quote_with_spaces', |
||
28 | 'test.double_quote_with_spaces', |
||
29 | 'choose.single_quote_with_spaces', |
||
30 | 'choose.double_quote_with_spaces', |
||
31 | 'test.with_domain', // Extracting explicit domain is not supported yet. We extract them in the default domain. |
||
32 | // dynamic_key. is not exported as it is not the full key but only the first part of a dynamically-built key |
||
33 | ) |
||
34 | ); |
||
35 | |||
36 | $this->assertEqualsCanonicalizing($expected, $catalogue->all());// Order of translations is not relevant for the testing |
||
37 | } |
||
38 | |||
39 | public static function providePaths(): iterable |
||
44 | ); |
||
45 | } |
||
47 |