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

« back to all changes in this revision

Viewing changes to tests/phpunit/languages/LanguageRuTest.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
 * based on LanguageBe_tarask.php
 
5
 * @copyright Copyright © 2012, Amir E. Aharoni
 
6
 * @file
 
7
 */
 
8
 
 
9
/** Tests for MediaWiki languages/classes/LanguageRu.php */
 
10
class LanguageRuTest extends MediaWikiTestCase {
 
11
        private $lang;
 
12
 
 
13
        function setUp() {
 
14
                $this->lang = Language::factory( 'ru' );
 
15
        }
 
16
        function tearDown() {
 
17
                unset( $this->lang );
 
18
        }
 
19
 
 
20
        /** @dataProvider providePluralFourForms */
 
21
        function testPluralFourForms( $result, $value ) {
 
22
                $forms = array( 'one', 'few', 'many', 'other' );
 
23
                $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 
24
        }
 
25
 
 
26
        function providePluralFourForms() {
 
27
                return array (
 
28
                        array( 'one', 1 ),
 
29
                        array( 'many', 11 ),
 
30
                        array( 'one', 91 ),
 
31
                        array( 'one', 121 ),
 
32
                        array( 'few', 2 ),
 
33
                        array( 'few', 3 ),
 
34
                        array( 'few', 4 ),
 
35
                        array( 'few', 334 ),
 
36
                        array( 'many', 5 ),
 
37
                        array( 'many', 15 ),
 
38
                        array( 'many', 120 ),
 
39
                );
 
40
        }
 
41
        /** @dataProvider providePluralTwoForms */
 
42
        function testPluralTwoForms( $result, $value ) {
 
43
                $forms =  array( 'one', 'several' );
 
44
                $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
 
45
        }
 
46
        function providePluralTwoForms() {
 
47
                return array (
 
48
                        array( 'one', 1 ),
 
49
                        array( 'several', 11 ),
 
50
                        array( 'several', 91 ),
 
51
                        array( 'several', 121 ),
 
52
                );
 
53
        }
 
54
}