MediaWiki REL1_33
LanguageUzTest.php
Go to the documentation of this file.
1<?php
24
29 public function testConversionToCyrillic() {
30 // A convertion of Latin to Cyrillic
31 $this->assertEquals( 'абвгғ',
32 $this->convertToCyrillic( 'abvggʻ' )
33 );
34 // Same as above, but assert that -{}-s must be removed and not converted
35 $this->assertEquals( 'ljабnjвгўоdb',
36 $this->convertToCyrillic( '-{lj}-ab-{nj}-vgoʻo-{db}-' )
37 );
38 // A simple convertion of Cyrillic to Cyrillic
39 $this->assertEquals( 'абвг',
40 $this->convertToCyrillic( 'абвг' )
41 );
42 // Same as above, but assert that -{}-s must be removed and not converted
43 $this->assertEquals( 'ljабnjвгdaž',
44 $this->convertToCyrillic( '-{lj}-аб-{nj}-вг-{da}-ž' )
45 );
46 }
47
51 public function testConversionToLatin() {
52 // A simple convertion of Latin to Latin
53 $this->assertEquals( 'abdef',
54 $this->convertToLatin( 'abdef' )
55 );
56 // A convertion of Cyrillic to Latin
57 $this->assertEquals( 'gʻabtsdOʻQyo',
58 $this->convertToLatin( 'ғабцдЎҚё' )
59 );
60 }
61
62 # #### HELPERS #####################################################
69 protected function assertUnConverted( $text, $variant, $msg = '' ) {
70 $this->assertEquals(
71 $text,
72 $this->convertTo( $text, $variant ),
73 $msg
74 );
75 }
76
83 protected function assertConverted( $text, $variant, $msg = '' ) {
84 $this->assertNotEquals(
85 $text,
86 $this->convertTo( $text, $variant ),
87 $msg
88 );
89 }
90
98 protected function assertCyrillic( $text, $msg = '' ) {
99 $this->assertUnConverted( $text, 'uz-cyrl', $msg );
100 $this->assertConverted( $text, 'uz-latn', $msg );
101 }
102
110 protected function assertLatin( $text, $msg = '' ) {
111 $this->assertUnConverted( $text, 'uz-latn', $msg );
112 $this->assertConverted( $text, 'uz-cyrl', $msg );
113 }
114
116 protected function convertTo( $text, $variant ) {
117 return $this->getLang()->mConverter->convertTo( $text, $variant );
118 }
119
120 protected function convertToCyrillic( $text ) {
121 return $this->convertTo( $text, 'uz-cyrl' );
122 }
123
124 protected function convertToLatin( $text ) {
125 return $this->convertTo( $text, 'uz-latn' );
126 }
127}
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
Helping class to run tests using a clean language instance.
LanguageUz UzConverter.
convertToCyrillic( $text)
assertUnConverted( $text, $variant, $msg='')
Wrapper to verify text stay the same after applying conversion.
assertCyrillic( $text, $msg='')
Verifiy the given Cyrillic text is not converted when using using the Cyrillic variant and converted ...
assertLatin( $text, $msg='')
Verifiy the given Latin text is not converted when using using the Latin variant and converted to Cyr...
convertTo( $text, $variant)
Wrapper for converter::convertTo() method.
assertConverted( $text, $variant, $msg='')
Wrapper to verify a text is different once converted to a variant.
testConversionToLatin()
LanguageConverter::convertTo.