r110461 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110460‎ | r110461 | r110462 >
Date:04:53, 1 February 2012
Author:amire80
Status:ok
Tags:
Comment:
Adding plural tests for more languages.
Modified paths:
  • /trunk/phase3/tests/phpunit/languages/LanguageMtTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageNsoTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguagePlTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageRuTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageSeTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageSgsTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageShTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageSkTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageSlTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageSmaTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageTiTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageTlTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageUkTest.php (added) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageWaTest.php (added) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/languages/LanguagePlTest.php
@@ -0,0 +1,72 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/classes/LanguagePl.php */
 10+class LanguagePlTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'pl' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ /** @dataProvider providerPluralFourForms */
 21+ function testPluralFourForms( $result, $value ) {
 22+ $forms = array( 'one', 'few', 'many' );
 23+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 24+ }
 25+
 26+ function providerPluralFourForms() {
 27+ return array (
 28+ array( 'many', 0 ),
 29+ array( 'one', 1 ),
 30+ array( 'few', 2 ),
 31+ array( 'few', 3 ),
 32+ array( 'few', 4 ),
 33+ array( 'many', 5 ),
 34+ array( 'many', 9 ),
 35+ array( 'many', 10 ),
 36+ array( 'many', 11 ),
 37+ array( 'many', 21 ),
 38+ array( 'few', 22 ),
 39+ array( 'few', 23 ),
 40+ array( 'few', 24 ),
 41+ array( 'many', 25 ),
 42+ array( 'many', 200 ),
 43+ array( 'many', 201 ),
 44+ );
 45+ }
 46+
 47+ /** @dataProvider providerPlural */
 48+ function testPlural( $result, $value ) {
 49+ $forms = array( 'one', 'many' );
 50+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 51+ }
 52+
 53+ function providerPlural() {
 54+ return array (
 55+ array( 'many', 0 ),
 56+ array( 'one', 1 ),
 57+ array( 'many', 2 ),
 58+ array( 'many', 3 ),
 59+ array( 'many', 4 ),
 60+ array( 'many', 5 ),
 61+ array( 'many', 9 ),
 62+ array( 'many', 10 ),
 63+ array( 'many', 11 ),
 64+ array( 'many', 21 ),
 65+ array( 'many', 22 ),
 66+ array( 'many', 23 ),
 67+ array( 'many', 24 ),
 68+ array( 'many', 25 ),
 69+ array( 'many', 200 ),
 70+ array( 'many', 201 ),
 71+ );
 72+ }
 73+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguagePlTest.php
___________________________________________________________________
Added: svn:eol-style
174 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageTiTest.php
@@ -0,0 +1,32 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/classes/LanguageTi.php */
 10+class LanguageTiTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'Ti' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ /** @dataProvider providerPlural */
 21+ function testPlural( $result, $value ) {
 22+ $forms = array( 'one', 'many' );
 23+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 24+ }
 25+
 26+ function providerPlural() {
 27+ return array (
 28+ array( 'one', 0 ),
 29+ array( 'one', 1 ),
 30+ array( 'many', 2 ),
 31+ );
 32+ }
 33+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageTiTest.php
___________________________________________________________________
Added: svn:eol-style
134 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageTlTest.php
@@ -0,0 +1,32 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/classes/LanguageTl.php */
 10+class LanguageTlTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'Tl' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ /** @dataProvider providerPlural */
 21+ function testPlural( $result, $value ) {
 22+ $forms = array( 'one', 'many' );
 23+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 24+ }
 25+
 26+ function providerPlural() {
 27+ return array (
 28+ array( 'one', 0 ),
 29+ array( 'one', 1 ),
 30+ array( 'many', 2 ),
 31+ );
 32+ }
 33+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageTlTest.php
___________________________________________________________________
Added: svn:eol-style
134 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageSmaTest.php
@@ -0,0 +1,48 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/classes/LanguageSma.php */
 10+class LanguageSmaTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'sma' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ /** @dataProvider providerPluralThreeForms */
 21+ function testPluralThreeForms( $result, $value ) {
 22+ $forms = array( 'one', 'two', 'other' );
 23+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 24+ }
 25+
 26+ function providerPluralThreeForms() {
 27+ return array (
 28+ array( 'other', 0 ),
 29+ array( 'one', 1 ),
 30+ array( 'two', 2 ),
 31+ array( 'other', 3 ),
 32+ );
 33+ }
 34+
 35+ /** @dataProvider providerPlural */
 36+ function testPlural( $result, $value ) {
 37+ $forms = array( 'one', 'other' );
 38+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 39+ }
 40+
 41+ function providerPlural() {
 42+ return array (
 43+ array( 'other', 0 ),
 44+ array( 'one', 1 ),
 45+ array( 'other', 2 ),
 46+ array( 'other', 3 ),
 47+ );
 48+ }
 49+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageSmaTest.php
___________________________________________________________________
Added: svn:eol-style
150 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageRuTest.php
@@ -0,0 +1,54 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * based on LanguageBe_tarask.php
 6+ * @copyright Copyright © 2012, Amir E. Aharoni
 7+ * @file
 8+ */
 9+
 10+/** Tests for MediaWiki languages/classes/LanguageRu.php */
 11+class LanguageRuTest extends MediaWikiTestCase {
 12+ private $lang;
 13+
 14+ function setUp() {
 15+ $this->lang = Language::factory( 'ru' );
 16+ }
 17+ function tearDown() {
 18+ unset( $this->lang );
 19+ }
 20+
 21+ /** @dataProvider providePluralFourForms */
 22+ function testPluralFourForms( $result, $value ) {
 23+ $forms = array( 'one', 'few', 'many', 'other' );
 24+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 25+ }
 26+
 27+ function providePluralFourForms() {
 28+ return array (
 29+ array( 'one', 1 ),
 30+ array( 'many', 11 ),
 31+ array( 'one', 91 ),
 32+ array( 'one', 121 ),
 33+ array( 'few', 2 ),
 34+ array( 'few', 3 ),
 35+ array( 'few', 4 ),
 36+ array( 'few', 334 ),
 37+ array( 'many', 5 ),
 38+ array( 'many', 15 ),
 39+ array( 'many', 120 ),
 40+ );
 41+ }
 42+ /** @dataProvider providePluralTwoForms */
 43+ function testPluralTwoForms( $result, $value ) {
 44+ $forms = array( 'one', 'several' );
 45+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 46+ }
 47+ function providePluralTwoForms() {
 48+ return array (
 49+ array( 'one', 1 ),
 50+ array( 'several', 11 ),
 51+ array( 'several', 91 ),
 52+ array( 'several', 121 ),
 53+ );
 54+ }
 55+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageRuTest.php
___________________________________________________________________
Added: svn:eol-style
156 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageSgsTest.php
@@ -0,0 +1,66 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/classes/LanguageSgs.php */
 10+class LanguageSgsTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'Sgs' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ /** @dataProvider providePluralAllForms */
 21+ function testPluralAllForms( $result, $value ) {
 22+ $forms = array( 'one', 'few', 'many', 'other' );
 23+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 24+ }
 25+
 26+ function providePluralAllForms() {
 27+ return array (
 28+ array( 'many', 0 ),
 29+ array( 'one', 1 ),
 30+ array( 'few', 2 ),
 31+ array( 'other', 3 ),
 32+ array( 'many', 10 ),
 33+ array( 'many', 11 ),
 34+ array( 'many', 12 ),
 35+ array( 'many', 19 ),
 36+ array( 'other', 20 ),
 37+ array( 'many', 100 ),
 38+ array( 'one', 101 ),
 39+ array( 'many', 111 ),
 40+ array( 'many', 112 ),
 41+ );
 42+ }
 43+
 44+ /** @dataProvider providePluralTwoForms */
 45+ function testPluralTwoForms( $result, $value ) {
 46+ $forms = array( 'one', 'other' );
 47+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 48+ }
 49+
 50+ function providePluralTwoForms() {
 51+ return array (
 52+ array( 'other', 0 ),
 53+ array( 'one', 1 ),
 54+ array( 'other', 2 ),
 55+ array( 'other', 3 ),
 56+ array( 'other', 10 ),
 57+ array( 'other', 11 ),
 58+ array( 'other', 12 ),
 59+ array( 'other', 19 ),
 60+ array( 'other', 20 ),
 61+ array( 'other', 100 ),
 62+ array( 'one', 101 ),
 63+ array( 'other', 111 ),
 64+ array( 'other', 112 ),
 65+ );
 66+ }
 67+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageSgsTest.php
___________________________________________________________________
Added: svn:eol-style
168 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageNsoTest.php
@@ -0,0 +1,32 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/classes/LanguageNso.php */
 10+class LanguageNsoTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'nso' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ /** @dataProvider providerPlural */
 21+ function testPlural( $result, $value ) {
 22+ $forms = array( 'one', 'many' );
 23+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 24+ }
 25+
 26+ function providerPlural() {
 27+ return array (
 28+ array( 'one', 0 ),
 29+ array( 'one', 1 ),
 30+ array( 'many', 2 ),
 31+ );
 32+ }
 33+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageNsoTest.php
___________________________________________________________________
Added: svn:eol-style
134 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageSeTest.php
@@ -0,0 +1,48 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/classes/LanguageSe.php */
 10+class LanguageSeTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'se' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ /** @dataProvider providerPluralThreeForms */
 21+ function testPluralThreeForms( $result, $value ) {
 22+ $forms = array( 'one', 'two', 'other' );
 23+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 24+ }
 25+
 26+ function providerPluralThreeForms() {
 27+ return array (
 28+ array( 'other', 0 ),
 29+ array( 'one', 1 ),
 30+ array( 'two', 2 ),
 31+ array( 'other', 3 ),
 32+ );
 33+ }
 34+
 35+ /** @dataProvider providerPlural */
 36+ function testPlural( $result, $value ) {
 37+ $forms = array( 'one', 'other' );
 38+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 39+ }
 40+
 41+ function providerPlural() {
 42+ return array (
 43+ array( 'other', 0 ),
 44+ array( 'one', 1 ),
 45+ array( 'other', 2 ),
 46+ array( 'other', 3 ),
 47+ );
 48+ }
 49+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageSeTest.php
___________________________________________________________________
Added: svn:eol-style
150 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageWaTest.php
@@ -0,0 +1,32 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/classes/LanguageWa.php */
 10+class LanguageWaTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'Wa' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ /** @dataProvider providerPlural */
 21+ function testPlural( $result, $value ) {
 22+ $forms = array( 'one', 'many' );
 23+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 24+ }
 25+
 26+ function providerPlural() {
 27+ return array (
 28+ array( 'one', 0 ),
 29+ array( 'one', 1 ),
 30+ array( 'many', 2 ),
 31+ );
 32+ }
 33+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageWaTest.php
___________________________________________________________________
Added: svn:eol-style
134 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageShTest.php
@@ -0,0 +1,32 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/classes/LanguageSh.php */
 10+class LanguageShTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'sh' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ /** @dataProvider providerPlural */
 21+ function testPlural( $result, $value ) {
 22+ $forms = array( 'one', 'many' );
 23+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 24+ }
 25+
 26+ function providerPlural() {
 27+ return array (
 28+ array( 'many', 0 ),
 29+ array( 'one', 1 ),
 30+ array( 'many', 2 ),
 31+ );
 32+ }
 33+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageShTest.php
___________________________________________________________________
Added: svn:eol-style
134 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageSkTest.php
@@ -0,0 +1,40 @@
 2+<?php
 3+/**
 4+ * @author Santhosh Thottingal
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * based on LanguageSkTest.php
 7+ * @file
 8+ */
 9+
 10+/** Tests for MediaWiki languages/classes/LanguageSk.php */
 11+class LanguageSkTest extends MediaWikiTestCase {
 12+ private $lang;
 13+
 14+ function setUp() {
 15+ $this->lang = Language::factory( 'sk' );
 16+ }
 17+ function tearDown() {
 18+ unset( $this->lang );
 19+ }
 20+
 21+ /** @dataProvider providerPlural */
 22+ function testPlural( $result, $value ) {
 23+ $forms = array( 'one', 'few', 'other' );
 24+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 25+ }
 26+
 27+ function providerPlural() {
 28+ return array (
 29+ array( 'other', 0 ),
 30+ array( 'one', 1 ),
 31+ array( 'few', 2 ),
 32+ array( 'few', 3 ),
 33+ array( 'few', 4 ),
 34+ array( 'other', 5 ),
 35+ array( 'other', 11 ),
 36+ array( 'other', 20 ),
 37+ array( 'other', 25 ),
 38+ array( 'other', 200 ),
 39+ );
 40+ }
 41+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageSkTest.php
___________________________________________________________________
Added: svn:eol-style
142 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageSlTest.php
@@ -0,0 +1,42 @@
 2+<?php
 3+/**
 4+ * @author Santhosh Thottingal
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * based on LanguageSkTest.php
 7+ * @file
 8+ */
 9+
 10+/** Tests for MediaWiki languages/classes/LanguageSl.php */
 11+class LanguageSlTest extends MediaWikiTestCase {
 12+ private $lang;
 13+
 14+ function setUp() {
 15+ $this->lang = Language::factory( 'sl' );
 16+ }
 17+ function tearDown() {
 18+ unset( $this->lang );
 19+ }
 20+
 21+ /** @dataProvider providerPlural */
 22+ function testPlural( $result, $value ) {
 23+ $forms = array( 'one', 'two', 'few', 'other', 'zero' );
 24+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 25+ }
 26+
 27+ function providerPlural() {
 28+ return array (
 29+ array( 'zero', 0 ),
 30+ array( 'one', 1 ),
 31+ array( 'two', 2 ),
 32+ array( 'few', 3 ),
 33+ array( 'few', 4 ),
 34+ array( 'other', 5 ),
 35+ array( 'other', 99 ),
 36+ array( 'other', 100 ),
 37+ array( 'one', 101 ),
 38+ array( 'two', 102 ),
 39+ array( 'few', 103 ),
 40+ array( 'one', 201 ),
 41+ );
 42+ }
 43+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageSlTest.php
___________________________________________________________________
Added: svn:eol-style
144 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageUkTest.php
@@ -0,0 +1,54 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * based on LanguageBe_tarask.php
 6+ * @copyright Copyright © 2012, Amir E. Aharoni
 7+ * @file
 8+ */
 9+
 10+/** Tests for MediaWiki languages/classes/LanguageUk.php */
 11+class LanguageUkTest extends MediaWikiTestCase {
 12+ private $lang;
 13+
 14+ function setUp() {
 15+ $this->lang = Language::factory( 'Uk' );
 16+ }
 17+ function tearDown() {
 18+ unset( $this->lang );
 19+ }
 20+
 21+ /** @dataProvider providePluralFourForms */
 22+ function testPluralFourForms( $result, $value ) {
 23+ $forms = array( 'one', 'few', 'many', 'other' );
 24+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 25+ }
 26+
 27+ function providePluralFourForms() {
 28+ return array (
 29+ array( 'one', 1 ),
 30+ array( 'many', 11 ),
 31+ array( 'one', 91 ),
 32+ array( 'one', 121 ),
 33+ array( 'few', 2 ),
 34+ array( 'few', 3 ),
 35+ array( 'few', 4 ),
 36+ array( 'few', 334 ),
 37+ array( 'many', 5 ),
 38+ array( 'many', 15 ),
 39+ array( 'many', 120 ),
 40+ );
 41+ }
 42+ /** @dataProvider providePluralTwoForms */
 43+ function testPluralTwoForms( $result, $value ) {
 44+ $forms = array( 'one', 'several' );
 45+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 46+ }
 47+ function providePluralTwoForms() {
 48+ return array (
 49+ array( 'one', 1 ),
 50+ array( 'several', 11 ),
 51+ array( 'several', 91 ),
 52+ array( 'several', 121 ),
 53+ );
 54+ }
 55+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageUkTest.php
___________________________________________________________________
Added: svn:eol-style
156 + native
Index: trunk/phase3/tests/phpunit/languages/LanguageMtTest.php
@@ -0,0 +1,72 @@
 2+<?php
 3+/**
 4+ * @author Amir E. Aharoni
 5+ * @copyright Copyright © 2012, Amir E. Aharoni
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/classes/LanguageMt.php */
 10+class LanguageMtTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'mt' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ /** @dataProvider providerPluralAllForms */
 21+ function testPluralAllForms( $result, $value ) {
 22+ $forms = array( 'one', 'few', 'many', 'other' );
 23+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 24+ }
 25+
 26+ function providerPluralAllForms() {
 27+ return array (
 28+ array( 'few', 0 ),
 29+ array( 'one', 1 ),
 30+ array( 'few', 2 ),
 31+ array( 'few', 10 ),
 32+ array( 'many', 11 ),
 33+ array( 'many', 19 ),
 34+ array( 'other', 20 ),
 35+ array( 'other', 99 ),
 36+ array( 'other', 100 ),
 37+ array( 'other', 101 ),
 38+ array( 'few', 102 ),
 39+ array( 'few', 110 ),
 40+ array( 'many', 111 ),
 41+ array( 'many', 119 ),
 42+ array( 'other', 120 ),
 43+ array( 'other', 201 ),
 44+ );
 45+ }
 46+
 47+ /** @dataProvider providerPluralTwoForms */
 48+ function testPluralTwoForms( $result, $value ) {
 49+ $forms = array( 'one', 'many' );
 50+ $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 51+ }
 52+
 53+ function providerPluralTwoForms() {
 54+ return array (
 55+ array( 'many', 0 ),
 56+ array( 'one', 1 ),
 57+ array( 'many', 2 ),
 58+ array( 'many', 10 ),
 59+ array( 'many', 11 ),
 60+ array( 'many', 19 ),
 61+ array( 'many', 20 ),
 62+ array( 'many', 99 ),
 63+ array( 'many', 100 ),
 64+ array( 'many', 101 ),
 65+ array( 'many', 102 ),
 66+ array( 'many', 110 ),
 67+ array( 'many', 111 ),
 68+ array( 'many', 119 ),
 69+ array( 'many', 120 ),
 70+ array( 'many', 201 ),
 71+ );
 72+ }
 73+}
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageMtTest.php
___________________________________________________________________
Added: svn:eol-style
174 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r110572== comparison for all languages, instead of ===, according to Niklas' suggest...amire8014:42, 2 February 2012

Status & tagging log