Index: trunk/phase3/tests/phpunit/languages/LanguageMoTest.php |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * @author Santhosh Thottingal |
| 5 | + * @copyright Copyright © 2012, Santhosh Thottingal |
| 6 | + * @file |
| 7 | + */ |
| 8 | + |
| 9 | +/** Tests for MediaWiki languages/classes/LanguageMo.php */ |
| 10 | +class LanguageMoTest extends MediaWikiTestCase { |
| 11 | + private $lang; |
| 12 | + |
| 13 | + function setUp() { |
| 14 | + $this->lang = Language::factory( 'mo' ); |
| 15 | + } |
| 16 | + function tearDown() { |
| 17 | + unset( $this->lang ); |
| 18 | + } |
| 19 | + |
| 20 | + /** @dataProvider providerPlural */ |
| 21 | + function testPlural( $result, $value ) { |
| 22 | + $forms = array( 'one', 'few', 'other' ); |
| 23 | + $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) ); |
| 24 | + } |
| 25 | + |
| 26 | + |
| 27 | + function providerPlural() { |
| 28 | + return array ( |
| 29 | + array( 'few', 0 ), |
| 30 | + array( 'one', 1 ), |
| 31 | + array( 'few', 2 ), |
| 32 | + array( 'few', 3 ), |
| 33 | + array( 'few', 19 ), |
| 34 | + array( 'few', 119 ), |
| 35 | + array( 'other', 20 ), |
| 36 | + array( 'other', 20.123 ), |
| 37 | + array( 'other', 31 ), |
| 38 | + array( 'other', 200 ), |
| 39 | + ); |
| 40 | + } |
| 41 | + |
| 42 | + |
| 43 | +} |
Property changes on: trunk/phase3/tests/phpunit/languages/LanguageMoTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 44 | + native |
Index: trunk/phase3/languages/classes/LanguageMo.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | |
22 | 22 | if ( $count == 1 ) { |
23 | 23 | $index = 0; |
24 | | - } elseif ( $count == 0 || $count % 100 < 20 ) { |
| 24 | + } elseif ( $count == 0 || ( $count % 100 > 1 && $count % 100 < 20 ) ) { |
25 | 25 | $index = 1; |
26 | 26 | } else { |
27 | 27 | $index = 2; |