MediaWiki REL1_30
FinderTest.php
Go to the documentation of this file.
1<?php
8namespace LocalisationUpdate;
9
10class FinderTest extends \PHPUnit_Framework_TestCase {
11 public function testGetComponents() {
12 $finder = new Finder(
13 [
14 'TranslateSearch' => '/IP/extensions/Translate/TranslateSearch.i18n.php',
15 'Babel' => '/IP/extensions/Babel/Babel.i18n.php',
16 ],
17 [
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/messages/Messages*.php",
32 'path' => 'languages/messages/i18n/*.json',
33 ];
34
35 $this->assertArrayHasKey( 'core', $observed );
36 $this->assertEquals( $expected, $observed['core'], 'Core php file' );
37
38 $expected = [
39 'repo' => 'extension',
40 'name' => 'Translate',
41 'orig' => 'file:///IP/extensions/Translate/TranslateSearch.i18n.php',
42 'path' => 'TranslateSearch.i18n.php'
43 ];
44 $this->assertArrayHasKey( 'TranslateSearch', $observed );
45 $this->assertEquals( $expected, $observed['TranslateSearch'], 'PHP only extension' );
46
47 $expected = [
48 'repo' => 'extension',
49 'name' => 'Babel',
50 'orig' => 'file:///IP/extensions/Babel/i18n/*.json',
51 'path' => 'i18n/*.json'
52 ];
53 $this->assertArrayHasKey( 'Babel-0', $observed );
54 $this->assertEquals( $expected, $observed['Babel-0'], 'PHP&JSON extension' );
55
56 $expected = [
57 'repo' => 'extension',
58 'name' => 'Door',
59 'orig' => 'file:///IP/extensions/Door/i18n/core/*.json',
60 'path' => 'i18n/core/*.json'
61 ];
62 $this->assertArrayHasKey( 'Door-core', $observed );
63 $this->assertEquals( $expected, $observed['Door-core'], 'Multidir json extension' );
64
65 $expected = [
66 'repo' => 'extension',
67 'name' => 'Door',
68 'orig' => 'file:///IP/extensions/Door/i18n/extra/*.json',
69 'path' => 'i18n/extra/*.json'
70 ];
71 $this->assertArrayHasKey( 'Door-extra', $observed );
72 $this->assertEquals( $expected, $observed['Door-extra'], 'Multidir json extension' );
73
74 $expected = [
75 'repo' => 'skin',
76 'name' => 'Vector',
77 'orig' => 'file:///IP/skins/Vector/i18n/*.json',
78 'path' => 'i18n/*.json'
79 ];
80 $this->assertArrayHasKey( 'Vector-0', $observed );
81 $this->assertEquals( $expected, $observed['Vector-0'], 'Json skin' );
82 }
83}
Interface for classes which provide list of components, which should be included for l10n updates.
Definition Finder.php:14