MediaWiki REL1_33
FinderTest.php
Go to the documentation of this file.
1<?php
8namespace LocalisationUpdate;
9
13class FinderTest extends \PHPUnit\Framework\TestCase {
14 public function testGetComponents() {
15 $finder = new Finder(
16 [
17 'TranslateSearch' => '/IP/extensions/Translate/TranslateSearch.i18n.php',
18 'Babel' => '/IP/extensions/Babel/Babel.i18n.php',
19 ],
20 [
21 'Babel' => '/IP/extensions/Babel/i18n',
22 'Door' => [
23 'core' => '/IP/extensions/Door/i18n/core',
24 'extra' => '/IP/extensions/Door/i18n/extra',
25 ],
26 'Vector' => '/IP/skins/Vector/i18n',
27 ],
28 '/IP'
29 );
30 $observed = $finder->getComponents();
31
32 $expected = [
33 'repo' => 'mediawiki',
34 'orig' => "file:///IP/languages/messages/Messages*.php",
35 'path' => 'languages/messages/i18n/*.json',
36 ];
37
38 $this->assertArrayHasKey( 'core', $observed );
39 $this->assertEquals( $expected, $observed['core'], 'Core php file' );
40
41 $expected = [
42 'repo' => 'extension',
43 'name' => 'Translate',
44 'orig' => 'file:///IP/extensions/Translate/TranslateSearch.i18n.php',
45 'path' => 'TranslateSearch.i18n.php'
46 ];
47 $this->assertArrayHasKey( 'TranslateSearch', $observed );
48 $this->assertEquals( $expected, $observed['TranslateSearch'], 'PHP only extension' );
49
50 $expected = [
51 'repo' => 'extension',
52 'name' => 'Babel',
53 'orig' => 'file:///IP/extensions/Babel/i18n/*.json',
54 'path' => 'i18n/*.json'
55 ];
56 $this->assertArrayHasKey( 'Babel-0', $observed );
57 $this->assertEquals( $expected, $observed['Babel-0'], 'PHP&JSON extension' );
58
59 $expected = [
60 'repo' => 'extension',
61 'name' => 'Door',
62 'orig' => 'file:///IP/extensions/Door/i18n/core/*.json',
63 'path' => 'i18n/core/*.json'
64 ];
65 $this->assertArrayHasKey( 'Door-core', $observed );
66 $this->assertEquals( $expected, $observed['Door-core'], 'Multidir json extension' );
67
68 $expected = [
69 'repo' => 'extension',
70 'name' => 'Door',
71 'orig' => 'file:///IP/extensions/Door/i18n/extra/*.json',
72 'path' => 'i18n/extra/*.json'
73 ];
74 $this->assertArrayHasKey( 'Door-extra', $observed );
75 $this->assertEquals( $expected, $observed['Door-extra'], 'Multidir json extension' );
76
77 $expected = [
78 'repo' => 'skin',
79 'name' => 'Vector',
80 'orig' => 'file:///IP/skins/Vector/i18n/*.json',
81 'path' => 'i18n/*.json'
82 ];
83 $this->assertArrayHasKey( 'Vector-0', $observed );
84 $this->assertEquals( $expected, $observed['Vector-0'], 'Json skin' );
85 }
86}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
\LocalisationUpdate\Finder
Interface for classes which provide list of components, which should be included for l10n updates.
Definition Finder.php:14