Index: trunk/phase3/maintenance/tests/phpunit/includes/LanguageConverterTest.php |
— | — | @@ -25,50 +25,35 @@ |
26 | 26 | } |
27 | 27 | |
28 | 28 | function testGetPreferredVariantDefaults() { |
29 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( false, false ) ); |
30 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( false, true ) ); |
31 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, false ) ); |
32 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, true ) ); |
| 29 | + $this->assertEquals( 'tg', $this->lc->getPreferredVariant() ); |
33 | 30 | } |
34 | 31 | |
35 | 32 | function testGetPreferredVariantHeaders() { |
36 | 33 | global $wgRequest; |
37 | 34 | $wgRequest->setHeader( 'Accept-Language', 'tg-latn' ); |
38 | 35 | |
39 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( false, false ) ); |
40 | | - $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant( false, true ) ); |
41 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, false ) ); |
42 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, true ) ); |
| 36 | + $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() ); |
43 | 37 | } |
44 | 38 | |
45 | 39 | function testGetPreferredVariantHeaderWeight() { |
46 | 40 | global $wgRequest; |
47 | 41 | $wgRequest->setHeader( 'Accept-Language', 'tg;q=1' ); |
48 | 42 | |
49 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( false, false ) ); |
50 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( false, true ) ); |
51 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, false ) ); |
52 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, true ) ); |
| 43 | + $this->assertEquals( 'tg', $this->lc->getPreferredVariant() ); |
53 | 44 | } |
54 | 45 | |
55 | 46 | function testGetPreferredVariantHeaderWeight2() { |
56 | 47 | global $wgRequest; |
57 | 48 | $wgRequest->setHeader( 'Accept-Language', 'tg-latn;q=1' ); |
58 | 49 | |
59 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( false, false ) ); |
60 | | - $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant( false, true ) ); |
61 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, false ) ); |
62 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, true ) ); |
| 50 | + $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() ); |
63 | 51 | } |
64 | 52 | |
65 | 53 | function testGetPreferredVariantHeaderMulti() { |
66 | 54 | global $wgRequest; |
67 | 55 | $wgRequest->setHeader( 'Accept-Language', 'en, tg-latn;q=1' ); |
68 | 56 | |
69 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( false, false ) ); |
70 | | - $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant( false, true ) ); |
71 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, false ) ); |
72 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, true ) ); |
| 57 | + $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() ); |
73 | 58 | } |
74 | 59 | |
75 | 60 | function testGetPreferredVariantUserOption() { |
— | — | @@ -79,10 +64,7 @@ |
80 | 65 | $wgUser->mDataLoaded = true; |
81 | 66 | $wgUser->setOption( 'variant', 'tg-latn' ); |
82 | 67 | |
83 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( false, false ) ); |
84 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( false, true ) ); |
85 | | - $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant( true, false ) ); |
86 | | - $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant( true, true ) ); |
| 68 | + $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() ); |
87 | 69 | } |
88 | 70 | |
89 | 71 | function testGetPreferredVariantHeaderUserVsUrl() { |
— | — | @@ -94,8 +76,7 @@ |
95 | 77 | $wgUser->setId( 1 ); |
96 | 78 | $wgUser->setOption( 'variant', 'tg-latn' ); // The user's data is ignored |
97 | 79 | // because the variant is set in the URL. |
98 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, false ) ); |
99 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( true, true ) ); |
| 80 | + $this->assertEquals( 'tg', $this->lc->getPreferredVariant() ); |
100 | 81 | } |
101 | 82 | |
102 | 83 | |
— | — | @@ -103,10 +84,7 @@ |
104 | 85 | global $wgDefaultLanguageVariant; |
105 | 86 | |
106 | 87 | $wgDefaultLanguageVariant = 'tg-latn'; |
107 | | - $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant( false, false ) ); |
108 | | - $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant( false, true ) ); |
109 | | - $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant( true, false ) ); |
110 | | - $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant( true, true ) ); |
| 88 | + $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() ); |
111 | 89 | } |
112 | 90 | |
113 | 91 | function testGetPreferredVariantDefaultLanguageVsUrlVariant() { |
— | — | @@ -115,10 +93,7 @@ |
116 | 94 | $wgContLang = Language::factory( 'tg-latn' ); |
117 | 95 | $wgDefaultLanguageVariant = 'tg'; |
118 | 96 | $wgRequest->setVal( 'variant', null ); |
119 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( false, false ) ); |
120 | | - $this->assertEquals( 'tg', $this->lc->getPreferredVariant( false, true ) ); |
121 | | - $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant( true, false ) ); |
122 | | - $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant( true, true ) ); |
| 97 | + $this->assertEquals( 'tg', $this->lc->getPreferredVariant() ); |
123 | 98 | } |
124 | 99 | } |
125 | 100 | |