66use Wikimedia \LanguageData \LanguageUtil ;
77
88/**
9- * @coversDefaultClass \Wikimedia\LanguageUtil
9+ * @covers \Wikimedia\LanguageData \LanguageUtil
1010 */
1111class LanguageUtilTest extends TestCase {
12- /**
13- * @var LanguageUtil
14- */
15- protected $ languageUtil ;
12+ protected LanguageUtil $ languageUtil ;
1613
1714 private const UNKNOWN_LANGUAGE_CODE = 'xyz ' ;
1815
@@ -21,33 +18,21 @@ protected function setUp(): void {
2118 $ this ->languageUtil = LanguageUtil::get ();
2219 }
2320
24- /**
25- * @covers isKnown
26- */
2721 public function testIsKnown () {
2822 $ this ->assertTrue ( $ this ->languageUtil ->isKnown ( 'en ' ) );
2923 $ this ->assertFalse ( $ this ->languageUtil ->isKnown ( self ::UNKNOWN_LANGUAGE_CODE ) );
3024 }
3125
32- /**
33- * @covers isRedirect
34- */
3526 public function testIsRedirect () {
3627 $ this ->assertFalse ( $ this ->languageUtil ->isRedirect ( 'en ' ) );
3728 $ this ->assertEquals ( 'aeb ' , $ this ->languageUtil ->isRedirect ( 'aeb-arab ' ) );
3829 }
3930
40- /**
41- * @covers getScript
42- */
4331 public function testGetScript () {
4432 $ this ->assertEquals ( 'Latn ' , $ this ->languageUtil ->getScript ( 'en ' ) );
4533 $ this ->assertFalse ( $ this ->languageUtil ->getScript ( self ::UNKNOWN_LANGUAGE_CODE ) );
4634 }
4735
48- /**
49- * @covers getRegions
50- */
5136 public function testGetRegions () {
5237 $ this ->assertFalse ( $ this ->languageUtil ->getRegions ( self ::UNKNOWN_LANGUAGE_CODE ) );
5338 $ this ->assertEquals ( [ 'AF ' ], $ this ->languageUtil ->getRegions ( 'aeb ' ) );
@@ -59,9 +44,6 @@ public function testGetRegions() {
5944 }
6045 }
6146
62- /**
63- * @covers getAutonym
64- */
6547 public function testGetAutonym () {
6648 $ this ->assertFalse ( $ this ->languageUtil ->getAutonym ( self ::UNKNOWN_LANGUAGE_CODE ) );
6749 $ this ->assertEquals (
@@ -73,9 +55,6 @@ public function testGetAutonym() {
7355 $ this ->assertEquals ( 'English ' , $ this ->languageUtil ->getAutonym ( 'en ' ) );
7456 }
7557
76- /**
77- * @covers getAutonyms
78- */
7958 public function testGetAutonyms () {
8059 $ autonyms = $ this ->languageUtil ->getAutonyms ();
8160 $ this ->assertEquals ( 'English ' , $ autonyms ['en ' ] );
@@ -85,9 +64,6 @@ public function testGetAutonyms() {
8564 );
8665 }
8766
88- /**
89- * @covers getLanguagesInScripts
90- */
9167 public function testGetLanguagesInScripts () {
9268 $ this ->assertCount (
9369 0 , $ this ->languageUtil ->getLanguagesInScripts ( [ self ::UNKNOWN_LANGUAGE_CODE ] )
@@ -104,9 +80,6 @@ public function testGetLanguagesInScripts() {
10480 );
10581 }
10682
107- /**
108- * @covers getGroupOfScript
109- */
11083 public function testGetGroupOfScript () {
11184 $ this ->assertEquals ( 'Latin ' , $ this ->languageUtil ->getGroupOfScript ( 'Latn ' ) );
11285 $ this ->assertEquals (
@@ -115,9 +88,6 @@ public function testGetGroupOfScript() {
11588 );
11689 }
11790
118- /**
119- * @covers getScriptGroupOfLanguage
120- */
12191 public function testGetScriptGroupOfLanguage () {
12292 $ this ->assertEquals (
12393 LanguageUtil::OTHER_SCRIPT_GROUP ,
@@ -130,9 +100,6 @@ public function testGetScriptGroupOfLanguage() {
130100 );
131101 }
132102
133- /**
134- * @covers getLanguagesByScriptGroup
135- */
136103 public function testGetLanguagesByScriptGroup () {
137104 $ actuals = $ this ->languageUtil ->getLanguagesByScriptGroup ( [ 'en ' , 'sr-el ' , 'tt-cyrl ' ] );
138105
@@ -141,9 +108,6 @@ public function testGetLanguagesByScriptGroup() {
141108 $ this ->assertContains ( 'sr-el ' , $ actuals ['Latin ' ] );
142109 }
143110
144- /**
145- * @covers getLanguagesByScriptGroupInRegions
146- */
147111 public function testGetLanguagesByScriptGroupInRegions () {
148112 $ actuals = $ this ->languageUtil ->getLanguagesByScriptGroupInRegions ( [ 'AS ' , 'PA ' ] );
149113
@@ -157,9 +121,6 @@ public function testGetLanguagesByScriptGroupInRegions() {
157121 );
158122 }
159123
160- /**
161- * @covers sortByAutonym
162- */
163124 public function testSortByAutonym () {
164125 $ sorted = $ this ->languageUtil ->sortByAutonym (
165126 [
@@ -185,9 +146,6 @@ public function testSortByAutonym() {
185146 );
186147 }
187148
188- /**
189- * @covers sortByScriptGroup
190- */
191149 public function testSortByScriptGroup () {
192150 $ sorted = $ this ->languageUtil ->sortByScriptGroup (
193151 $ this ->languageUtil ->sortByAutonym (
@@ -215,27 +173,18 @@ public function testSortByScriptGroup() {
215173 );
216174 }
217175
218- /**
219- * @covers isRtl
220- */
221176 public function testIsRtl () {
222177 $ this ->assertFalse ( $ this ->languageUtil ->isRtl ( 'en ' ) );
223178 $ this ->assertFalse ( $ this ->languageUtil ->isRtl ( self ::UNKNOWN_LANGUAGE_CODE ) );
224179 $ this ->assertTrue ( $ this ->languageUtil ->isRtl ( 'he ' ) );
225180 }
226181
227- /**
228- * @covers getDir
229- */
230182 public function testGetDir () {
231183 $ this ->assertEquals ( 'ltr ' , $ this ->languageUtil ->getDir ( 'en ' ) );
232184 $ this ->assertEquals ( 'rtl ' , $ this ->languageUtil ->getDir ( 'he ' ) );
233185 $ this ->assertFalse ( $ this ->languageUtil ->getDir ( self ::UNKNOWN_LANGUAGE_CODE ) );
234186 }
235187
236- /**
237- * @covers getLanguagesInTerritory
238- */
239188 public function testGetLanguagesInTerritory () {
240189 $ actualsAFG = $ this ->languageUtil ->getLanguagesInTerritory ( 'AF ' );
241190 $ actualsAT = $ this ->languageUtil ->getLanguagesInTerritory ( 'AT ' );
@@ -249,9 +198,6 @@ public function testGetLanguagesInTerritory() {
249198 $ this ->assertNotContains ( 'de ' , $ actualsAFG );
250199 }
251200
252- /**
253- * @covers addLanguage
254- */
255201 public function testAddLanguage () {
256202 $ this ->assertFalse ( $ this ->languageUtil ->isKnown ( 'xyz ' ) );
257203 $ this ->assertNotContains (
0 commit comments