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

« back to all changes in this revision

Viewing changes to tests/phpunit/languages/LanguageMtTest.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 Amir E. Aharoni
 
4
 * @copyright Copyright © 2012, Amir E. Aharoni
 
5
 * @file
 
6
 */
 
7
 
 
8
/** Tests for MediaWiki languages/classes/LanguageMt.php */
 
9
class LanguageMtTest extends MediaWikiTestCase {
 
10
        private $lang;
 
11
 
 
12
        function setUp() {
 
13
                $this->lang = Language::factory( 'mt' );
 
14
        }
 
15
        function tearDown() {
 
16
                unset( $this->lang );
 
17
        }
 
18
 
 
19
        /** @dataProvider providerPluralAllForms */
 
20
        function testPluralAllForms( $result, $value ) {
 
21
                $forms = array( 'one', 'few', 'many', 'other' );
 
22
                $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 
23
        }
 
24
 
 
25
        function providerPluralAllForms() {
 
26
                return array (
 
27
                        array( 'few',   0 ),
 
28
                        array( 'one',   1 ),
 
29
                        array( 'few',   2 ),
 
30
                        array( 'few',   10 ),
 
31
                        array( 'many',  11 ),
 
32
                        array( 'many',  19 ),
 
33
                        array( 'other', 20 ),
 
34
                        array( 'other', 99 ),
 
35
                        array( 'other', 100 ),
 
36
                        array( 'other', 101 ),
 
37
                        array( 'few',   102 ),
 
38
                        array( 'few',   110 ),
 
39
                        array( 'many',  111 ),
 
40
                        array( 'many',  119 ),
 
41
                        array( 'other', 120 ),
 
42
                        array( 'other', 201 ),
 
43
                );
 
44
        }
 
45
 
 
46
        /** @dataProvider providerPluralTwoForms */
 
47
        function testPluralTwoForms( $result, $value ) {
 
48
                $forms = array( 'one', 'many' );
 
49
                $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 
50
        }
 
51
 
 
52
        function providerPluralTwoForms() {
 
53
                return array (
 
54
                        array( 'many',  0 ),
 
55
                        array( 'one',   1 ),
 
56
                        array( 'many',  2 ),
 
57
                        array( 'many',  10 ),
 
58
                        array( 'many',  11 ),
 
59
                        array( 'many',  19 ),
 
60
                        array( 'many',  20 ),
 
61
                        array( 'many',  99 ),
 
62
                        array( 'many',  100 ),
 
63
                        array( 'many',  101 ),
 
64
                        array( 'many',  102 ),
 
65
                        array( 'many',  110 ),
 
66
                        array( 'many',  111 ),
 
67
                        array( 'many',  119 ),
 
68
                        array( 'many',  120 ),
 
69
                        array( 'many',  201 ),
 
70
                );
 
71
        }
 
72
}