I18nJsonFileIntegrityTest   A
last analyzed

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 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() {
37
38
		$provider = array();
39
		$location = $GLOBALS['wgMessagesDirs']['SemanticExternalQueryLookup'];
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