Completed
Push — master ( 5013dd...decfe1 )
by mw
03:55
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 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