77use PHPUnit \Framework \TestCase ;
88use Yiisoft \Strings \Inflector ;
99
10+ use function extension_loaded ;
11+
1012final class InflectorTest extends TestCase
1113{
1214 private function getTestDataForToPlural (): array
@@ -209,7 +211,7 @@ public function toSlugCommonsDataProvider(): array
209211 public function testToSlugCommons (string $ input , string $ expected , string $ replacement = '- ' ): void
210212 {
211213 $ inflector = new Inflector ();
212- if (\ extension_loaded ('intl ' )) {
214+ if (extension_loaded ('intl ' )) {
213215 $ this ->assertEquals ($ expected , $ inflector ->toSlug ($ input , $ replacement ));
214216 }
215217 $ this ->assertEquals ($ expected , $ inflector
@@ -219,7 +221,7 @@ public function testToSlugCommons(string $input, string $expected, string $repla
219221
220222 public function testToSlugWithIntl (): void
221223 {
222- if (!\ extension_loaded ('intl ' )) {
224+ if (!extension_loaded ('intl ' )) {
223225 $ this ->markTestSkipped ('intl extension is required. ' );
224226 }
225227
@@ -256,23 +258,28 @@ public function testToSlugWithIntl(): void
256258
257259 public function testToTransliteratedStrict (): void
258260 {
259- if (!\ extension_loaded ('intl ' )) {
261+ if (!extension_loaded ('intl ' )) {
260262 $ this ->markTestSkipped ('intl extension is required. ' );
261263 }
262264
263265 // Some test strings are from https://github.com/bergie/midgardmvc_helper_urlize. Thank you, Henri Bergius!
264266 $ data = [
265267 // Korean
266268 '해동검도 ' => 'haedong-geomdo ' ,
269+
267270 // Hiragana
268271 'ひらがな ' => 'hiragana ' ,
272+
269273 // Georgian
270274 'საქართველო ' => 'sakartvelo ' ,
275+
271276 // Arabic
272277 'العربي ' => 'ạlʿrby ' ,
273278 'عرب ' => 'ʿrb ' ,
279+
274280 // Hebrew
275281 'עִבְרִית ' => 'ʻibĕriyţ ' ,
282+
276283 // Turkish
277284 'Sanırım hepimiz aynı şeyi düşünüyoruz. ' => 'Sanırım hepimiz aynı şeyi düşünüyoruz. ' ,
278285
@@ -288,6 +295,7 @@ public function testToTransliteratedStrict(): void
288295
289296 // Spanish
290297 '¿Español? ' => '¿Español? ' ,
298+
291299 // Chinese
292300 '美国 ' => 'měi guó ' ,
293301 ];
@@ -301,23 +309,28 @@ public function testToTransliteratedStrict(): void
301309
302310 public function testToTransliteratedMedium (): void
303311 {
304- if (!\ extension_loaded ('intl ' )) {
312+ if (!extension_loaded ('intl ' )) {
305313 $ this ->markTestSkipped ('intl extension is required. ' );
306314 }
307315
308316 // Some test strings are from https://github.com/bergie/midgardmvc_helper_urlize. Thank you, Henri Bergius!
309317 $ data = [
310318 // Korean
311319 '해동검도 ' => ['haedong-geomdo ' ],
320+
312321 // Hiragana
313322 'ひらがな ' => ['hiragana ' ],
323+
314324 // Georgian
315325 'საქართველო ' => ['sakartvelo ' ],
326+
316327 // Arabic
317328 'العربي ' => ['alʿrby ' ],
318329 'عرب ' => ['ʿrb ' ],
330+
319331 // Hebrew
320332 'עִבְרִית ' => ['\'iberiyt ' , 'ʻiberiyt ' ],
333+
321334 // Turkish
322335 'Sanırım hepimiz aynı şeyi düşünüyoruz. ' => ['Sanirim hepimiz ayni seyi dusunuyoruz. ' ],
323336
@@ -332,7 +345,8 @@ public function testToTransliteratedMedium(): void
332345 'Српска: ђ, њ, џ! ' => ['Srpska: d, n, d! ' ],
333346
334347 // Spanish
335- '¿Español? ' => ['¿Espanol? ' ],
348+ '¿Español? ' => ['¿Espanol? ' , '?Espanol? ' ],
349+
336350 // Chinese
337351 '美国 ' => ['mei guo ' ],
338352 ];
@@ -346,23 +360,28 @@ public function testToTransliteratedMedium(): void
346360
347361 public function testToTransliteratedLoose (): void
348362 {
349- if (!\ extension_loaded ('intl ' )) {
363+ if (!extension_loaded ('intl ' )) {
350364 $ this ->markTestSkipped ('intl extension is required. ' );
351365 }
352366
353367 // Some test strings are from https://github.com/bergie/midgardmvc_helper_urlize. Thank you, Henri Bergius!
354368 $ data = [
355369 // Korean
356370 '해동검도 ' => ['haedong-geomdo ' ],
371+
357372 // Hiragana
358373 'ひらがな ' => ['hiragana ' ],
374+
359375 // Georgian
360376 'საქართველო ' => ['sakartvelo ' ],
377+
361378 // Arabic
362379 'العربي ' => ['alrby ' ],
363380 'عرب ' => ['rb ' ],
381+
364382 // Hebrew
365383 'עִבְרִית ' => ['\'iberiyt ' , 'iberiyt ' ],
384+
366385 // Turkish
367386 'Sanırım hepimiz aynı şeyi düşünüyoruz. ' => ['Sanirim hepimiz ayni seyi dusunuyoruz. ' ],
368387
@@ -377,7 +396,8 @@ public function testToTransliteratedLoose(): void
377396 'Српска: ђ, њ, џ! ' => ['Srpska: d, n, d! ' ],
378397
379398 // Spanish
380- '¿Español? ' => ['Espanol? ' ],
399+ '¿Español? ' => ['Espanol? ' , '?Espanol? ' ],
400+
381401 // Chinese
382402 '美国 ' => ['mei guo ' ],
383403 ];
@@ -391,7 +411,7 @@ public function testToTransliteratedLoose(): void
391411
392412 public function testToTransliteratedWithTransliterator (): void
393413 {
394- if (!\ extension_loaded ('intl ' )) {
414+ if (!extension_loaded ('intl ' )) {
395415 $ this ->markTestSkipped ('intl extension is required. ' );
396416 }
397417
@@ -401,7 +421,7 @@ public function testToTransliteratedWithTransliterator(): void
401421
402422 public function testToTransliteratedWithTransliterationMap (): void
403423 {
404- if (!\ extension_loaded ('intl ' )) {
424+ if (!extension_loaded ('intl ' )) {
405425 $ this ->markTestSkipped ('intl extension is required. ' );
406426 }
407427
0 commit comments