MediaWiki  1.33.0
LanguageTrTest.php
Go to the documentation of this file.
1 <?php
12 
24  public function testDottedAndDotlessI( $func, $input, $inputCase, $expected ) {
25  if ( $func == 'ucfirst' ) {
26  $res = $this->getLang()->ucfirst( $input );
27  } elseif ( $func == 'lcfirst' ) {
28  $res = $this->getLang()->lcfirst( $input );
29  } else {
30  throw new MWException( __METHOD__ . " given an invalid function name '$func'" );
31  }
32 
33  $msg = "Converting $inputCase case '$input' with $func should give '$expected'";
34 
35  $this->assertEquals( $expected, $res, $msg );
36  }
37 
38  public static function provideDottedAndDotlessI() {
39  return [
40  # function, input, input case, expected
41  # Case changed:
42  [ 'ucfirst', 'ı', 'lower', 'I' ],
43  [ 'ucfirst', 'i', 'lower', 'İ' ],
44  [ 'lcfirst', 'I', 'upper', 'ı' ],
45  [ 'lcfirst', 'İ', 'upper', 'i' ],
46 
47  # Already using the correct case
48  [ 'ucfirst', 'I', 'upper', 'I' ],
49  [ 'ucfirst', 'İ', 'upper', 'İ' ],
50  [ 'lcfirst', 'ı', 'lower', 'ı' ],
51  [ 'lcfirst', 'i', 'lower', 'i' ],
52 
53  # A real example taken from T30040 using
54  # https://tr.wikipedia.org/wiki/%C4%B0Phone
55  [ 'lcfirst', 'iPhone', 'lower', 'iPhone' ],
56 
57  # next case is valid in Turkish but are different words if we
58  # consider IPhone is English!
59  [ 'lcfirst', 'IPhone', 'upper', 'ıPhone' ],
60 
61  ];
62  }
63 }
LanguageClassesTestCase
Helping class to run tests using a clean language instance.
Definition: LanguageClassesTestCase.php:21
LanguageClassesTestCase\getLang
getLang()
Definition: LanguageClassesTestCase.php:41
LanguageTrTest\provideDottedAndDotlessI
static provideDottedAndDotlessI()
Definition: LanguageTrTest.php:38
$res
$res
Definition: database.txt:21
LanguageTrTest
LanguageTr.
Definition: LanguageTrTest.php:11
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:35
MWException
MediaWiki exception.
Definition: MWException.php:26
$input
if(is_array( $mode)) switch( $mode) $input
Definition: postprocess-phan.php:141
LanguageTrTest\testDottedAndDotlessI
testDottedAndDotlessI( $func, $input, $inputCase, $expected)
See T30040 Credits to irc://irc.freenode.net/wikipedia-tr users:
Definition: LanguageTrTest.php:24