MediaWiki  REL1_31
CollationFaTest.php
Go to the documentation of this file.
1 <?php
2 
7 
8  /*
9  * The ordering is a weird hack designed to work only with a very
10  * specific version of libicu, and as such can't really be unit tested
11  * against a random version of libicu
12  */
13 
14  public function setUp() {
15  parent::setUp();
16  $this->checkPHPExtension( 'intl' );
17  }
18 
22  public function testGetFirstLetter( $letter, $str ) {
23  $coll = new CollationFa;
24  $this->assertEquals( $letter, $coll->getFirstLetter( $str ), $str );
25  }
26 
27  public function provideGetFirstLetter() {
28  return [
29  [
30  '۷',
31  '۷'
32  ],
33  [
34  'ا',
35  'ا'
36  ],
37  [
38  'ا',
39  'ایران'
40  ],
41  [
42  'ب',
43  'برلین'
44  ],
45  [
46  'و',
47  'واو'
48  ],
49  [ "\xd8\xa7", "\xd8\xa7Foo" ],
50  [ "\xd9\x88", "\xd9\x88Foo" ],
51  [ "\xd9\xb2", "\xd9\xb2Foo" ],
52  [ "\xd9\xb3", "\xd9\xb3Foo" ],
53  ];
54  }
55 }
CollationFaTest\setUp
setUp()
Definition: CollationFaTest.php:14
CollationFaTest\provideGetFirstLetter
provideGetFirstLetter()
Definition: CollationFaTest.php:27
CollationFa
Temporary workaround for incorrect collation of Persian language ('fa') in ICU 52 (bug T139110).
Definition: CollationFa.php:31
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:37
MediaWikiTestCase
Definition: MediaWikiTestCase.php:17
CollationFaTest
CollationFa.
Definition: CollationFaTest.php:6
MediaWikiTestCase\checkPHPExtension
checkPHPExtension( $extName)
Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded.
Definition: MediaWikiTestCase.php:1989
CollationFaTest\testGetFirstLetter
testGetFirstLetter( $letter, $str)
provideGetFirstLetter
Definition: CollationFaTest.php:22