summaryrefslogtreecommitdiff
path: root/tests/phpunit/languages/LanguageUzTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/languages/LanguageUzTest.php')
-rw-r--r--tests/phpunit/languages/LanguageUzTest.php45
1 files changed, 23 insertions, 22 deletions
diff --git a/tests/phpunit/languages/LanguageUzTest.php b/tests/phpunit/languages/LanguageUzTest.php
index 72387283..13f57c16 100644
--- a/tests/phpunit/languages/LanguageUzTest.php
+++ b/tests/phpunit/languages/LanguageUzTest.php
@@ -10,26 +10,20 @@
* @copyright Copyright © 2012, Robin Pepermans
* @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/LanguageUz.php */
-class LanguageUzTest extends MediaWikiTestCase {
- /* Language object. Initialized before each test */
- private $lang;
-
- function setUp() {
- $this->lang = Language::factory( 'uz' );
- }
- function tearDown() {
- unset( $this->lang );
- }
+class LanguageUzTest extends LanguageClassesTestCase {
/**
* @author Nikola Smolenski
+ * @covers LanguageConverter::convertTo
*/
- function testConversionToCyrillic() {
+ public function testConversionToCyrillic() {
// A convertion of Latin to Cyrillic
$this->assertEquals( 'абвгғ',
$this->convertToCyrillic( 'abvggʻ' )
@@ -48,7 +42,10 @@ class LanguageUzTest extends MediaWikiTestCase {
);
}
- function testConversionToLatin() {
+ /**
+ * @covers LanguageConverter::convertTo
+ */
+ public function testConversionToLatin() {
// A simple convertion of Latin to Latin
$this->assertEquals( 'abdef',
$this->convertToLatin( 'abdef' )
@@ -66,20 +63,21 @@ class LanguageUzTest extends MediaWikiTestCase {
* @param $variant string Language variant 'uz-cyrl' or 'uz-latn'
* @param $msg string Optional message
*/
- function assertUnConverted( $text, $variant, $msg = '' ) {
+ protected function assertUnConverted( $text, $variant, $msg = '' ) {
$this->assertEquals(
$text,
$this->convertTo( $text, $variant ),
$msg
);
}
+
/**
* Wrapper to verify a text is different once converted to a variant.
* @param $text string Text to convert
* @param $variant string Language variant 'uz-cyrl' or 'uz-latn'
* @param $msg string Optional message
*/
- function assertConverted( $text, $variant, $msg = '' ) {
+ protected function assertConverted( $text, $variant, $msg = '' ) {
$this->assertNotEquals(
$text,
$this->convertTo( $text, $variant ),
@@ -92,29 +90,32 @@ class LanguageUzTest extends MediaWikiTestCase {
* 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, 'uz-cyrl', $msg );
$this->assertConverted( $text, 'uz-latn', $msg );
}
+
/**
* Verifiy the given Latin text is not converted when using
* 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, 'uz-latn', $msg );
$this->assertConverted( $text, 'uz-cyrl', $msg );
}
/** Wrapper for converter::convertTo() method*/
- function convertTo( $text, $variant ) {
- return $this->lang->mConverter->convertTo( $text, $variant );
+ protected function convertTo( $text, $variant ) {
+ return $this->getLang()->mConverter->convertTo( $text, $variant );
}
- function convertToCyrillic( $text ) {
+
+ protected function convertToCyrillic( $text ) {
return $this->convertTo( $text, 'uz-cyrl' );
}
- function convertToLatin( $text ) {
+
+ protected function convertToLatin( $text ) {
return $this->convertTo( $text, 'uz-latn' );
}
}