MediaWiki  1.34.0
JSONReaderTest.php
Go to the documentation of this file.
1 <?php
8 namespace LocalisationUpdate;
9 
13 class 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 }
LocalisationUpdate\JSONReaderTest
@covers \LocalisationUpdate\JSONReader
Definition: JSONReaderTest.php:13
LocalisationUpdate\JSONReader
Reads MediaWiki JSON i18n files.
Definition: JSONReader.php:13
LocalisationUpdate\JSONReaderTest\testParse
testParse( $input, $expected, $comment)
@dataProvider parseProvider
Definition: JSONReaderTest.php:17
LocalisationUpdate
Definition: Fetcher.php:8
LocalisationUpdate\JSONReaderTest\parseProvider
parseProvider()
Definition: JSONReaderTest.php:23