* @author Antoine Musso <hashar at free dot fr>
* @copyright Copyright © 2011, Antoine Musso <hashar at free dot fr>
* @file
+ *
+ * @todo methods in test class should be tidied:
+ * - Should be split into separate test methods and data providers
+ * - Tests for LanguageConverter and Language should probably be separate..
*/
-require_once dirname( __DIR__ ) . '/bootstrap.php';
-
/** Tests for MediaWiki languages/LanguageSr.php */
class LanguageSrTest extends LanguageClassesTestCase {
- function testEasyConversions() {
+ /**
+ * @covers LanguageConverter::convertTo
+ */
+ public function testEasyConversions() {
$this->assertCyrillic(
'шђчћжШЂЧЋЖ',
'Cyrillic guessing characters'
);
}
- function testMixedConversions() {
+ /**
+ * @covers LanguageConverter::convertTo
+ */
+ public function testMixedConversions() {
$this->assertCyrillic(
'шђчћжШЂЧЋЖ - šđčćž',
'Mostly cyrillic characters'
);
}
- function testSameAmountOfLatinAndCyrillicGetConverted() {
+ /**
+ * @covers LanguageConverter::convertTo
+ */
+ public function testSameAmountOfLatinAndCyrillicGetConverted() {
$this->assertConverted(
'4 latin: šđčć | 4 cyrillic: шђчћ',
'sr-ec'
/**
* @author Nikola Smolenski
+ * @covers LanguageConverter::convertTo
*/
- function testConversionToCyrillic() {
+ public function testConversionToCyrillic() {
//A simple convertion of Latin to Cyrillic
$this->assertEquals( 'абвг',
$this->convertToCyrillic( 'abvg' )
);
}
- function testConversionToLatin() {
+ /**
+ * @covers LanguageConverter::convertTo
+ */
+ public function testConversionToLatin() {
//A simple convertion of Latin to Latin
$this->assertEquals( 'abcd',
$this->convertToLatin( 'abcd' )
);
}
- /** @dataProvider providePlural */
- function testPlural( $result, $value ) {
+ /**
+ * @dataProvider providePlural
+ * @covers Language::convertPlural
+ */
+ public function testPlural( $result, $value ) {
$forms = array( 'one', 'few', 'many', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
- /** @dataProvider providePlural */
- function testGetPluralRuleType( $result, $value ) {
+ /**
+ * @dataProvider providePlural
+ * @covers Language::getPluralRuleType
+ */
+ public function testGetPluralRuleType( $result, $value ) {
$this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
}
);
}
- /** @dataProvider providePluralTwoForms */
- function testPluralTwoForms( $result, $value ) {
+ /**
+ * @dataProvider providePluralTwoForms
+ * @covers Language::convertPlural
+ */
+ public function testPluralTwoForms( $result, $value ) {
$forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
* @param $variant string Language variant 'sr-ec' or 'sr-el'
* @param $msg string Optional message
*/
- function assertUnConverted( $text, $variant, $msg = '' ) {
+ protected function assertUnConverted( $text, $variant, $msg = '' ) {
$this->assertEquals(
$text,
$this->convertTo( $text, $variant ),
* @param $variant string Language variant 'sr-ec' or 'sr-el'
* @param $msg string Optional message
*/
- function assertConverted( $text, $variant, $msg = '' ) {
+ protected function assertConverted( $text, $variant, $msg = '' ) {
$this->assertNotEquals(
$text,
$this->convertTo( $text, $variant ),
* using the cyrillic variant and converted to Latin when using
* the Latin variant.
*/
- function assertCyrillic( $text, $msg = '' ) {
+ protected function assertCyrillic( $text, $msg = '' ) {
$this->assertUnConverted( $text, 'sr-ec', $msg );
$this->assertConverted( $text, 'sr-el', $msg );
}
* using the Latin variant and converted to Cyrillic when using
* the Cyrillic variant.
*/
- function assertLatin( $text, $msg = '' ) {
+ protected function assertLatin( $text, $msg = '' ) {
$this->assertUnConverted( $text, 'sr-el', $msg );
$this->assertConverted( $text, 'sr-ec', $msg );
}
-
/** Wrapper for converter::convertTo() method*/
- function convertTo( $text, $variant ) {
+ protected function convertTo( $text, $variant ) {
return $this->getLang()
->mConverter
->convertTo(
);
}
- function convertToCyrillic( $text ) {
+ protected function convertToCyrillic( $text ) {
return $this->convertTo( $text, 'sr-ec' );
}
- function convertToLatin( $text ) {
+ protected function convertToLatin( $text ) {
return $this->convertTo( $text, 'sr-el' );
}
}