1 | <?php |
||
16 | class I18nJsonFileIntegrityTest extends \PHPUnit_Framework_TestCase { |
||
17 | |||
18 | /** |
||
19 | * @dataProvider i18nFileProvider |
||
20 | */ |
||
21 | public function testI18NJsonDecodeEncode( $file ) { |
||
22 | |||
23 | $jsonFileReader = UtilityFactory::getInstance()->newJsonFileReader( $file ); |
||
24 | |||
25 | $this->assertIsInt( |
||
26 | $jsonFileReader->getModificationTime() |
||
27 | ); |
||
28 | |||
29 | $this->assertIsArray( |
||
30 | $jsonFileReader->read() |
||
31 | ); |
||
32 | } |
||
33 | |||
34 | public function i18nFileProvider() { |
||
35 | |||
36 | $provider = []; |
||
37 | $location = $GLOBALS['wgMessagesDirs']['SemanticApprovedRevs']; |
||
38 | |||
39 | if ( !is_array( $location ) ) { |
||
40 | $location = [ $location ]; |
||
41 | } |
||
42 | foreach ( $location as $oneDir ) { |
||
43 | $bulkFileProvider = UtilityFactory::getInstance()->newBulkFileProvider( $oneDir ); |
||
44 | $bulkFileProvider->searchByFileExtension( 'json' ); |
||
45 | |||
46 | foreach ( $bulkFileProvider->getFiles() as $file ) { |
||
47 | $provider[] = [ $file ]; |
||
48 | } |
||
49 | } |
||
50 | return $provider; |
||
51 | } |
||
52 | |||
54 |