MediaWiki REL1_34
JSONReaderTest.php
Go to the documentation of this file.
1<?php
8namespace LocalisationUpdate;
9
13class JSONReaderTest extends \PHPUnit\Framework\TestCase {
17 public function testParse( $input, $expected, $comment ) {
18 $reader = new JSONReader( 'xx' );
19 $observed = $reader->parse( $input );
20 $this->assertEquals( $expected, $observed['xx'], $comment );
21 }
22
23 public function parseProvider() {
24 return [
25 [
26 '{}',
27 [],
28 'empty file',
29 ],
30 [
31 '{"key":"value"}',
32 [ 'key' => 'value' ],
33 'file with one string',
34 ],
35 [
36 '{"@metadata":{"authors":["Nike"]},"key":"value2"}',
37 [ 'key' => 'value2' ],
38 '@metadata is ignored',
39 ]
40 ];
41 }
42}
@covers \LocalisationUpdate\JSONReader
testParse( $input, $expected, $comment)
@dataProvider parseProvider
Reads MediaWiki JSON i18n files.