wiki.techinc.nl/tests/phpunit/languages/LanguageHeTest.php
Antoine Musso a03bf9e27f tests: rm duplicate code in language classes
The language classes have been using the same setUp() tearDown() to
craft a new language object. I have abstracted that code in
LanguageClassesTestCase and made all the language test classes to extend
it. The language is interpolated directly from the class name and an
object for it can be retrieved with the getLang() method.

Change-Id: Ib931336ce219edabe2c72b7e9f04c976a500723e
2012-10-29 09:40:30 +01:00

40 lines
1 KiB
PHP

<?php
/**
* @author Amir E. Aharoni
* @copyright Copyright © 2012, Amir E. Aharoni
* @file
*/
/** Tests for MediaWiki languages/classes/LanguageHe.php */
class LanguageHeTest extends LanguageClassesTestCase {
/** @dataProvider providerPluralDual */
function testPluralDual( $result, $value ) {
$forms = array( 'one', 'two', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPluralDual() {
return array (
array( 'other', 0 ), // Zero -> plural
array( 'one', 1 ), // Singular
array( 'two', 2 ), // Dual
array( 'other', 3 ), // Plural
);
}
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
$forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
return array (
array( 'other', 0 ), // Zero -> plural
array( 'one', 1 ), // Singular
array( 'other', 2 ), // Plural, no dual provided
array( 'other', 3 ), // Plural
);
}
}