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

I18nJsonFileIntegrityTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testI18NJsonDecodeEncode() 0 14 1
A i18nFileProvider() 0 14 2
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