diff options
Diffstat (limited to 'tests/phpunit/includes/languages')
-rw-r--r-- | tests/phpunit/includes/languages/LanguageBsTest.php | 13 | ||||
-rw-r--r-- | tests/phpunit/includes/languages/LanguageDsbTest.php | 13 | ||||
-rw-r--r-- | tests/phpunit/includes/languages/LanguageFiTest.php | 40 | ||||
-rw-r--r-- | tests/phpunit/includes/languages/LanguageGaTest.php | 19 | ||||
-rw-r--r-- | tests/phpunit/includes/languages/LanguageHsbTest.php | 13 | ||||
-rw-r--r-- | tests/phpunit/includes/languages/LanguageHuTest.php | 25 | ||||
-rw-r--r-- | tests/phpunit/includes/languages/LanguageHyTest.php | 16 | ||||
-rw-r--r-- | tests/phpunit/includes/languages/LanguageLaTest.php | 71 | ||||
-rw-r--r-- | tests/phpunit/includes/languages/LanguageOsTest.php | 47 | ||||
-rw-r--r-- | tests/phpunit/includes/languages/LanguageSlTest.php | 13 |
10 files changed, 270 insertions, 0 deletions
diff --git a/tests/phpunit/includes/languages/LanguageBsTest.php b/tests/phpunit/includes/languages/LanguageBsTest.php index 8d46d33126ba..7333113f5de9 100644 --- a/tests/phpunit/includes/languages/LanguageBsTest.php +++ b/tests/phpunit/includes/languages/LanguageBsTest.php @@ -44,4 +44,17 @@ class LanguageBsTest extends LanguageClassesTestCase { [ 'other', 200 ], ]; } + + /** + * @dataProvider provideConvertGrammar + */ + public function testConvertGrammar( string $word, string $case, string $expected ): void { + $this->assertSame( $expected, $this->getLang()->convertGrammar( $word, $case ) ); + } + + public static function provideConvertGrammar(): iterable { + yield [ 'word', 'instrumental', 's word' ]; + yield [ 'word', 'lokativ', 'o word' ]; + yield [ 'word', 'nominativ', 'word' ]; + } } diff --git a/tests/phpunit/includes/languages/LanguageDsbTest.php b/tests/phpunit/includes/languages/LanguageDsbTest.php index 3087426767c9..7d0714988d5e 100644 --- a/tests/phpunit/includes/languages/LanguageDsbTest.php +++ b/tests/phpunit/includes/languages/LanguageDsbTest.php @@ -41,4 +41,17 @@ class LanguageDsbTest extends LanguageClassesTestCase { [ 'other', 555 ], ]; } + + /** + * @dataProvider provideConvertGrammar + */ + public function testConvertGrammar( string $word, string $case, string $expected ): void { + $this->assertSame( $expected, $this->getLang()->convertGrammar( $word, $case ) ); + } + + public static function provideConvertGrammar(): iterable { + yield [ 'word', 'nominatiw', 'word' ]; + yield [ 'word', 'instrumental', 'wo z word' ]; + yield [ 'word', 'lokatiw', 'wo word' ]; + } } diff --git a/tests/phpunit/includes/languages/LanguageFiTest.php b/tests/phpunit/includes/languages/LanguageFiTest.php new file mode 100644 index 000000000000..fb9efd76e493 --- /dev/null +++ b/tests/phpunit/includes/languages/LanguageFiTest.php @@ -0,0 +1,40 @@ +<?php +declare( strict_types=1 ); + +/** + * @group Language + * @covers LanguageFi + */ +class LanguageFiTest extends LanguageClassesTestCase { + /** + * @dataProvider provideConvertGrammar + */ + public function testConvertGrammar( string $word, string $case, string $expected ): void { + $this->assertSame( $expected, $this->getLang()->convertGrammar( $word, $case ) ); + } + + public static function provideConvertGrammar(): iterable { + $wordCaseMappings = [ + 'talo' => [ + 'genitive' => 'talon', + 'elative' => 'talosta', + 'partitive' => 'taloa', + 'illative' => 'taloon', + 'inessive' => 'talossa', + ], + 'pastöroitu' => [ + 'partitive' => 'pastöroitua', + ], + 'Wikipedia' => [ + 'elative' => 'Wikipediasta', + 'partitive' => 'Wikipediaa', + ], + ]; + + foreach ( $wordCaseMappings as $word => $caseMappings ) { + foreach ( $caseMappings as $case => $expected ) { + yield "$word $case" => [ (string)$word, $case, $expected ]; + } + } + } +} diff --git a/tests/phpunit/includes/languages/LanguageGaTest.php b/tests/phpunit/includes/languages/LanguageGaTest.php index fc6a5ac3a236..08cd052e072f 100644 --- a/tests/phpunit/includes/languages/LanguageGaTest.php +++ b/tests/phpunit/includes/languages/LanguageGaTest.php @@ -37,4 +37,23 @@ class LanguageGaTest extends LanguageClassesTestCase { [ 'other', 200 ], ]; } + + /** + * @dataProvider provideConvertGrammar + */ + public function testConvertGrammar( string $word, string $case, string $expected ): void { + $this->assertSame( $expected, $this->getLang()->convertGrammar( $word, $case ) ); + } + + public static function provideConvertGrammar(): iterable { + yield [ 'an Domhnach', 'ainmlae', 'Dé Domhnaigh' ]; + yield [ 'an Luan', 'ainmlae', 'Dé Luain' ]; + yield [ 'an Mháirt', 'ainmlae', 'Dé Mháirt' ]; + yield [ 'an Chéadaoin', 'ainmlae', 'Dé Chéadaoin' ]; + yield [ 'an Déardaoin', 'ainmlae', 'Déardaoin' ]; + yield [ 'an Aoine', 'ainmlae', 'Dé hAoine' ]; + yield [ 'an Satharn', 'ainmlae', 'Dé Sathairn' ]; + + yield [ 'an Domhnach', 'other', 'an Domhnach' ]; + } } diff --git a/tests/phpunit/includes/languages/LanguageHsbTest.php b/tests/phpunit/includes/languages/LanguageHsbTest.php index c90983daab17..728496438b8e 100644 --- a/tests/phpunit/includes/languages/LanguageHsbTest.php +++ b/tests/phpunit/includes/languages/LanguageHsbTest.php @@ -41,4 +41,17 @@ class LanguageHsbTest extends LanguageClassesTestCase { [ 'other', 555 ], ]; } + + /** + * @dataProvider provideConvertGrammar + */ + public function testConvertGrammar( string $word, string $case, string $expected ): void { + $this->assertSame( $expected, $this->getLang()->convertGrammar( $word, $case ) ); + } + + public static function provideConvertGrammar(): iterable { + yield [ 'word', 'nominatiw', 'word' ]; + yield [ 'word', 'instrumental', 'z word' ]; + yield [ 'word', 'lokatiw', 'wo word' ]; + } } diff --git a/tests/phpunit/includes/languages/LanguageHuTest.php b/tests/phpunit/includes/languages/LanguageHuTest.php index a8b0a578840e..445d164a65f5 100644 --- a/tests/phpunit/includes/languages/LanguageHuTest.php +++ b/tests/phpunit/includes/languages/LanguageHuTest.php @@ -35,4 +35,29 @@ class LanguageHuTest extends LanguageClassesTestCase { [ 'other', 200 ], ]; } + + /** + * @dataProvider provideConvertGrammar + */ + public function testConvertGrammar( string $word, string $case, string $expected ): void { + $this->assertSame( $expected, $this->getLang()->convertGrammar( $word, $case ) ); + } + + public static function provideConvertGrammar(): iterable { + $wordCaseMappings = [ + 'kocsmafal' => [ + 'rol' => 'kocsmafalról', + 'ba' => 'kocsmafalba', + ], + 'Bevezető' => [ + 'k' => 'Bevezetők', + ], + ]; + + foreach ( $wordCaseMappings as $word => $caseMappings ) { + foreach ( $caseMappings as $case => $expected ) { + yield "$word $case" => [ (string)$word, $case, $expected ]; + } + } + } } diff --git a/tests/phpunit/includes/languages/LanguageHyTest.php b/tests/phpunit/includes/languages/LanguageHyTest.php index 01e8be7a17e0..44548b69cd93 100644 --- a/tests/phpunit/includes/languages/LanguageHyTest.php +++ b/tests/phpunit/includes/languages/LanguageHyTest.php @@ -37,4 +37,20 @@ class LanguageHyTest extends LanguageClassesTestCase { [ 'other', 200 ], ]; } + + /** + * @dataProvider provideConvertGrammar + */ + public function testConvertGrammar( string $word, string $case, string $expected ): void { + $this->assertSame( $expected, $this->getLang()->convertGrammar( $word, $case ) ); + } + + public static function provideConvertGrammar(): iterable { + yield [ 'Մաունա', 'genitive', 'Մաունայի' ]; + yield [ 'հետո', 'genitive', 'հետոյի' ]; + yield [ 'գիրք', 'genitive', 'գրքի' ]; + yield [ 'ժամանակի', 'genitive', 'ժամանակիի' ]; + + yield [ 'Մաունա', 'dative', 'Մաունա' ]; + } } diff --git a/tests/phpunit/includes/languages/LanguageLaTest.php b/tests/phpunit/includes/languages/LanguageLaTest.php new file mode 100644 index 000000000000..6b8f895c1664 --- /dev/null +++ b/tests/phpunit/includes/languages/LanguageLaTest.php @@ -0,0 +1,71 @@ +<?php +declare( strict_types=1 ); + +/** + * @group Language + * @covers LanguageLa + */ +class LanguageLaTest extends LanguageClassesTestCase { + /** + * @dataProvider provideConvertGrammar + */ + public function testConvertGrammar( string $word, string $case, string $expected ): void { + $this->assertSame( $expected, $this->getLang()->convertGrammar( $word, $case ) ); + } + + public static function provideConvertGrammar(): iterable { + $wordCaseMappings = [ + 'translatio' => [ + 'genitive' => 'translationis', + 'accusative' => 'translationem', + 'ablative' => 'translatione', + ], + 'ursus' => [ + 'genitive' => 'ursi', + 'accusative' => 'ursum', + 'ablative' => 'urso', + ], + 'gens' => [ + 'genitive' => 'gentis', + 'accusative' => 'gentem', + 'ablative' => 'gente', + ], + 'bellum' => [ + 'genitive' => 'belli', + 'accusative' => 'bellum', + 'ablative' => 'bello', + ], + 'communia' => [ + 'genitive' => 'communium', + 'accusative' => 'communia', + 'ablative' => 'communibus', + ], + 'libri' => [ + 'genitive' => 'librorum', + 'accusative' => 'libros', + 'ablative' => 'libris', + ], + 'dies' => [ + 'genitive' => 'diei', + 'accusative' => 'diem', + 'ablative' => 'die', + ], + 'declinatio' => [ + 'genitive' => 'declinationis', + 'accusative' => 'declinationem', + 'ablative' => 'declinatione', + ], + 'vanitas' => [ + 'genitive' => 'vanitatis', + 'accusative' => 'vanitatem', + 'ablative' => 'vanitate', + ], + ]; + + foreach ( $wordCaseMappings as $word => $caseMappings ) { + foreach ( $caseMappings as $case => $expected ) { + yield "$word $case" => [ (string)$word, $case, $expected ]; + } + } + } +} diff --git a/tests/phpunit/includes/languages/LanguageOsTest.php b/tests/phpunit/includes/languages/LanguageOsTest.php new file mode 100644 index 000000000000..dc4bb44c8309 --- /dev/null +++ b/tests/phpunit/includes/languages/LanguageOsTest.php @@ -0,0 +1,47 @@ +<?php +declare( strict_types=1 ); + +/** + * @group Language + * @covers LanguageOs + */ +class LanguageOsTest extends LanguageClassesTestCase { + /** + * @dataProvider provideConvertGrammar + */ + public function testConvertGrammar( string $word, string $case, string $expected ): void { + $this->assertSame( $expected, $this->getLang()->convertGrammar( $word, $case ) ); + } + + public static function provideConvertGrammar(): iterable { + $wordCaseMappings = [ + 'бæстæ' => [ + 'genitive' => 'бæсты', + 'allative' => 'бæстæм', + 'dative' => 'бæстæн', + 'ablative' => 'бæстæй', + 'inessive' => 'бæст', + 'superessive' => 'бæстыл', + ], + + 'лæппу' => [ + 'genitive' => 'лæппуйы', + 'allative' => 'лæппумæ', + 'dative' => 'лæппуйæн', + 'ablative' => 'лæппуйæ', + 'inessive' => 'лæппу', + 'superessive' => 'лæппуйыл', + ], + + '2011' => [ + 'equative' => '2011-ау', + ], + ]; + + foreach ( $wordCaseMappings as $word => $caseMappings ) { + foreach ( $caseMappings as $case => $expected ) { + yield "$word $case" => [ (string)$word, $case, $expected ]; + } + } + } +} diff --git a/tests/phpunit/includes/languages/LanguageSlTest.php b/tests/phpunit/includes/languages/LanguageSlTest.php index ab5d0efa7afd..f99445a7db85 100644 --- a/tests/phpunit/includes/languages/LanguageSlTest.php +++ b/tests/phpunit/includes/languages/LanguageSlTest.php @@ -43,4 +43,17 @@ class LanguageSlTest extends LanguageClassesTestCase { [ 'one', 201 ], ]; } + + /** + * @dataProvider provideConvertGrammar + */ + public function testConvertGrammar( string $word, string $case, string $expected ): void { + $this->assertSame( $expected, $this->getLang()->convertGrammar( $word, $case ) ); + } + + public static function provideConvertGrammar(): iterable { + yield [ 'word', 'mestnik', 'o word' ]; + yield [ 'word', 'orodnik', 'z word' ]; + yield [ 'word', 'imenovalnik', 'word' ]; + } } |