~ubuntu-branches/ubuntu/trusty/mediawiki/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/phpunit/languages/LanguageGvTest.php

  • Committer: Package Import Robot
  • Author(s): Thorsten Glaser
  • Date: 2014-03-28 09:56:29 UTC
  • mfrom: (1.3.14)
  • Revision ID: package-import@ubuntu.com-20140328095629-1526y9tchdd507id
Tags: 1:1.19.14+dfsg-1
* New upstream security fix release (Closes: #742857):
  - (bug 62497) SECURITY: Add CSRF token on Special:ChangePassword
  - (bug 62467) Set a title for the context during import on the cli
* Use upstream-provided signing key bundle

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * @author Santhosh Thottingal
 
4
 * @copyright Copyright © 2012, Santhosh Thottingal
 
5
 * @file
 
6
 */
 
7
 
 
8
/** Tests for MediaWiki languages/classes/LanguageGv.php */
 
9
class LanguageGvTest extends MediaWikiTestCase {
 
10
        private $lang;
 
11
 
 
12
        function setUp() {
 
13
                $this->lang = Language::factory( 'gv' );
 
14
        }
 
15
        function tearDown() {
 
16
                unset( $this->lang );
 
17
        }
 
18
 
 
19
        /** @dataProvider providerPlural */
 
20
        function testPlural( $result, $value ) {
 
21
                // This is not compatible with CLDR plural rules http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#gv
 
22
                $forms =  array( 'Form 1', 'Form 2', 'Form 3', 'Form 4' );
 
23
                $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 
24
        }
 
25
        function providerPlural() {
 
26
                return array (
 
27
                        array( 'Form 4', 0 ),
 
28
                        array( 'Form 2', 1 ),
 
29
                        array( 'Form 3', 2 ),
 
30
                        array( 'Form 4', 3 ),
 
31
                        array( 'Form 1', 20 ),
 
32
                        array( 'Form 2', 21 ),
 
33
                        array( 'Form 3', 22 ),
 
34
                        array( 'Form 4', 23 ),
 
35
                        array( 'Form 4', 50 ),
 
36
                );
 
37
        }
 
38
 
 
39
}