Completed
Push — master ( 1895e8...30a208 )
by Jeroen De
02:49
created

I18nJsonFileIntegrityTest::i18nFileProvider()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace SCQ\Tests\Integration;
4
5
use SMW\Tests\Utils\UtilityFactory;
6
7
/**
8
 * @group semantic-compound-queries
9
 *
10
 * @license GNU GPL v2+
11
 * @since 1.0
12
 *
13
 * @author mwjames
14
 */
15
class I18nJsonFileIntegrityTest extends \PHPUnit_Framework_TestCase {
16
17
	/**
18
	 * @dataProvider i18nFileProvider
19
	 */
20
	public function testI18NJsonDecodeEncode( $file ) {
21
22
		$jsonFileReader = UtilityFactory::getInstance()->newJsonFileReader( $file );
23
24
		$this->assertInternalType(
25
			'integer',
26
			$jsonFileReader->getModificationTime()
27
		);
28
29
		$this->assertInternalType(
30
			'array',
31
			$jsonFileReader->read()
32
		);
33
	}
34
35
	public function i18nFileProvider() {
36
37
		$provider = [];
38
		$location = $GLOBALS['wgMessagesDirs']['SemanticCompoundQueries'];
39
40
		$bulkFileProvider = UtilityFactory::getInstance()->newBulkFileProvider( $location );
41
		$bulkFileProvider->searchByFileExtension( 'json' );
42
43
		foreach ( $bulkFileProvider->getFiles() as $file ) {
44
			$provider[] = [ $file ];
45
		}
46
47
		return $provider;
48
	}
49
50
}
51