These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace SEQL\Tests\Integration; |
||
4 | |||
5 | use SMW\Tests\Utils\UtilityFactory; |
||
6 | |||
7 | /** |
||
8 | * @group semantic-external-query-lookup |
||
9 | * @group medium |
||
10 | * |
||
11 | * @license GNU GPL v2+ |
||
12 | * @since 1.0 |
||
13 | * |
||
14 | * @author mwjames |
||
15 | */ |
||
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->assertInternalType( |
||
26 | 'integer', |
||
27 | $jsonFileReader->getModificationTime() |
||
28 | ); |
||
29 | |||
30 | $this->assertInternalType( |
||
31 | 'array', |
||
32 | $jsonFileReader->read() |
||
33 | ); |
||
34 | } |
||
35 | |||
36 | public function i18nFileProvider() { |
||
0 ignored issues
–
show
|
|||
37 | |||
38 | $provider = array(); |
||
39 | $location = $GLOBALS['wgMessagesDirs']['semantic-external-query-lookup']; |
||
40 | |||
41 | $bulkFileProvider = UtilityFactory::getInstance()->newBulkFileProvider( $location ); |
||
42 | $bulkFileProvider->searchByFileExtension( 'json' ); |
||
43 | |||
44 | foreach ( $bulkFileProvider->getFiles() as $file ) { |
||
45 | $provider[] = array( $file ); |
||
46 | } |
||
47 | |||
48 | return $provider; |
||
49 | } |
||
50 | |||
51 | } |
||
52 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: