MediaWiki  1.23.12
LanguageUzTest.php
Go to the documentation of this file.
1 <?php
21 
26  public function testConversionToCyrillic() {
27  // A convertion of Latin to Cyrillic
28  $this->assertEquals( 'абвгғ',
29  $this->convertToCyrillic( 'abvggʻ' )
30  );
31  // Same as above, but assert that -{}-s must be removed and not converted
32  $this->assertEquals( 'ljабnjвгўоdb',
33  $this->convertToCyrillic( '-{lj}-ab-{nj}-vgoʻo-{db}-' )
34  );
35  // A simple convertion of Cyrillic to Cyrillic
36  $this->assertEquals( 'абвг',
37  $this->convertToCyrillic( 'абвг' )
38  );
39  // Same as above, but assert that -{}-s must be removed and not converted
40  $this->assertEquals( 'ljабnjвгdaž',
41  $this->convertToCyrillic( '-{lj}-аб-{nj}-вг-{da}-ž' )
42  );
43  }
44 
48  public function testConversionToLatin() {
49  // A simple convertion of Latin to Latin
50  $this->assertEquals( 'abdef',
51  $this->convertToLatin( 'abdef' )
52  );
53  // A convertion of Cyrillic to Latin
54  $this->assertEquals( 'gʻabtsdOʻQyo',
55  $this->convertToLatin( 'ғабцдЎҚё' )
56  );
57  }
58 
59  ##### HELPERS #####################################################
60 
66  protected function assertUnConverted( $text, $variant, $msg = '' ) {
67  $this->assertEquals(
68  $text,
69  $this->convertTo( $text, $variant ),
70  $msg
71  );
72  }
73 
80  protected function assertConverted( $text, $variant, $msg = '' ) {
81  $this->assertNotEquals(
82  $text,
83  $this->convertTo( $text, $variant ),
84  $msg
85  );
86  }
87 
93  protected function assertCyrillic( $text, $msg = '' ) {
94  $this->assertUnConverted( $text, 'uz-cyrl', $msg );
95  $this->assertConverted( $text, 'uz-latn', $msg );
96  }
97 
103  protected function assertLatin( $text, $msg = '' ) {
104  $this->assertUnConverted( $text, 'uz-latn', $msg );
105  $this->assertConverted( $text, 'uz-cyrl', $msg );
106  }
107 
109  protected function convertTo( $text, $variant ) {
110  return $this->getLang()->mConverter->convertTo( $text, $variant );
111  }
112 
113  protected function convertToCyrillic( $text ) {
114  return $this->convertTo( $text, 'uz-cyrl' );
115  }
116 
117  protected function convertToLatin( $text ) {
118  return $this->convertTo( $text, 'uz-latn' );
119  }
120 }
LanguageUzTest\assertCyrillic
assertCyrillic( $text, $msg='')
Verifiy the given Cyrillic text is not converted when using using the cyrillic variant and converted ...
Definition: LanguageUzTest.php:93
LanguageClassesTestCase
Helping class to run tests using a clean language instance.
Definition: LanguageClassesTestCase.php:21
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
LanguageClassesTestCase\getLang
getLang()
Definition: LanguageClassesTestCase.php:41
LanguageUzTest\testConversionToLatin
testConversionToLatin()
@covers LanguageConverter::convertTo
Definition: LanguageUzTest.php:48
LanguageUzTest\assertConverted
assertConverted( $text, $variant, $msg='')
Wrapper to verify a text is different once converted to a variant.
Definition: LanguageUzTest.php:80
LanguageUzTest\convertTo
convertTo( $text, $variant)
Wrapper for converter::convertTo() method.
Definition: LanguageUzTest.php:109
LanguageUzTest\convertToLatin
convertToLatin( $text)
Definition: LanguageUzTest.php:117
LanguageUzTest\convertToCyrillic
convertToCyrillic( $text)
Definition: LanguageUzTest.php:113
LanguageUzTest\assertUnConverted
assertUnConverted( $text, $variant, $msg='')
Wrapper to verify text stay the same after applying conversion.
Definition: LanguageUzTest.php:66
LanguageUzTest\assertLatin
assertLatin( $text, $msg='')
Verifiy the given Latin text is not converted when using using the Latin variant and converted to Cyr...
Definition: LanguageUzTest.php:103
LanguageUzTest\testConversionToCyrillic
testConversionToCyrillic()
Definition: LanguageUzTest.php:26
LanguageUzTest
Tests for MediaWiki languages/LanguageUz.php.
Definition: LanguageUzTest.php:20