Completed
Push — master ( 5013dd...decfe1 )
by mw
03:55
created

I18nJsonFileIntegrityTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 38
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 SCI\Tests\Structure;
4
5
use SMW\Tests\Utils\UtilityFactory;
6
use SMW\Tests\PHPUnitCompat;
7
8
/**
9
 * @group semantic-cite
10
 * @group medium
11
 *
12
 * @license GNU GPL v2+
13
 * @since 1.0
14
 *
15
 * @author mwjames
16
 */
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