]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - tests/phpunit/languages/classes/LanguageSmaTest.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / tests / phpunit / languages / classes / LanguageSmaTest.php
diff --git a/tests/phpunit/languages/classes/LanguageSmaTest.php b/tests/phpunit/languages/classes/LanguageSmaTest.php
new file mode 100644 (file)
index 0000000..6b85994
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+/**
+ * @author Amir E. Aharoni
+ * @copyright Copyright © 2012, Amir E. Aharoni
+ * @file
+ */
+
+/** Tests for MediaWiki languages/classes/LanguageSma.php */
+class LanguageSmaTest extends LanguageClassesTestCase {
+       /**
+        * @dataProvider providePlural
+        * @covers Language::convertPlural
+        */
+       public function testPlural( $result, $value ) {
+               $forms = [ 'one', 'two', 'other' ];
+               $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
+       }
+
+       /**
+        * @dataProvider providePlural
+        * @covers Language::getPluralRuleType
+        */
+       public function testGetPluralRuleType( $result, $value ) {
+               $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
+       }
+
+       public static function providePlural() {
+               return [
+                       [ 'other', 0 ],
+                       [ 'one', 1 ],
+                       [ 'two', 2 ],
+                       [ 'other', 3 ],
+               ];
+       }
+
+       /**
+        * @dataProvider providePluralTwoForms
+        * @covers Language::convertPlural
+        */
+       public function testPluralTwoForms( $result, $value ) {
+               $forms = [ 'one', 'other' ];
+               $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
+       }
+
+       public static function providePluralTwoForms() {
+               return [
+                       [ 'other', 0 ],
+                       [ 'one', 1 ],
+                       [ 'other', 2 ],
+                       [ 'other', 3 ],
+               ];
+       }
+}