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