aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/languages/LanguageFiTest.php
blob: fb9efd76e4932ac995bcef4e77b2bcfc9f1e98bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 ];
			}
		}
	}
}