MediaWiki  1.34.0
FinderTest.php
Go to the documentation of this file.
1 <?php
8 namespace LocalisationUpdate;
9 
13 class FinderTest extends \PHPUnit\Framework\TestCase {
14  public function testGetComponents() {
15  $finder = new Finder(
16  [
17  'core' => '/IP/languages/i18n',
18  'Babel' => '/IP/extensions/Babel/i18n',
19  'Door' => [
20  'core' => '/IP/extensions/Door/i18n/core',
21  'extra' => '/IP/extensions/Door/i18n/extra',
22  ],
23  'Vector' => '/IP/skins/Vector/i18n',
24  ],
25  '/IP'
26  );
27  $observed = $finder->getComponents();
28 
29  $expected = [
30  'repo' => 'mediawiki',
31  'orig' => "file:///IP/languages/i18n/*.json",
32  'path' => 'languages/i18n/*.json',
33  ];
34  $this->assertArrayHasKey( 'core-0', $observed );
35  $this->assertEquals( $expected, $observed['core-0'], 'Core JSON file' );
36 
37  $expected = [
38  'repo' => 'extension',
39  'name' => 'Babel',
40  'orig' => 'file:///IP/extensions/Babel/i18n/*.json',
41  'path' => 'i18n/*.json'
42  ];
43  $this->assertArrayHasKey( 'Babel-0', $observed );
44  $this->assertEquals( $expected, $observed['Babel-0'], 'JSON extension' );
45 
46  $expected = [
47  'repo' => 'extension',
48  'name' => 'Door',
49  'orig' => 'file:///IP/extensions/Door/i18n/core/*.json',
50  'path' => 'i18n/core/*.json'
51  ];
52  $this->assertArrayHasKey( 'Door-core', $observed );
53  $this->assertEquals( $expected, $observed['Door-core'], 'Multidir json extension' );
54 
55  $expected = [
56  'repo' => 'extension',
57  'name' => 'Door',
58  'orig' => 'file:///IP/extensions/Door/i18n/extra/*.json',
59  'path' => 'i18n/extra/*.json'
60  ];
61  $this->assertArrayHasKey( 'Door-extra', $observed );
62  $this->assertEquals( $expected, $observed['Door-extra'], 'Multidir json extension' );
63 
64  $expected = [
65  'repo' => 'skin',
66  'name' => 'Vector',
67  'orig' => 'file:///IP/skins/Vector/i18n/*.json',
68  'path' => 'i18n/*.json'
69  ];
70  $this->assertArrayHasKey( 'Vector-0', $observed );
71  $this->assertEquals( $expected, $observed['Vector-0'], 'Json skin' );
72  }
73 }
LocalisationUpdate\FinderTest
@covers \LocalisationUpdate\Finder
Definition: FinderTest.php:13
LocalisationUpdate
Definition: Fetcher.php:8
LocalisationUpdate\FinderTest\testGetComponents
testGetComponents()
Definition: FinderTest.php:14