r75639 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75638‎ | r75639 | r75640 >
Date:02:55, 29 October 2010
Author:philip
Status:deferred
Tags:
Comment:
Fix the LanguageConverterTest to prevent test failures after the changes made on getPreferredVariant() at r75617.
Modified paths:
  • /trunk/phase3/maintenance/tests/phpunit/includes/LanguageConverterTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/phpunit/includes/LanguageConverterTest.php
@@ -25,50 +25,35 @@
2626 }
2727
2828 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() );
3330 }
3431
3532 function testGetPreferredVariantHeaders() {
3633 global $wgRequest;
3734 $wgRequest->setHeader( 'Accept-Language', 'tg-latn' );
3835
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() );
4337 }
4438
4539 function testGetPreferredVariantHeaderWeight() {
4640 global $wgRequest;
4741 $wgRequest->setHeader( 'Accept-Language', 'tg;q=1' );
4842
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() );
5344 }
5445
5546 function testGetPreferredVariantHeaderWeight2() {
5647 global $wgRequest;
5748 $wgRequest->setHeader( 'Accept-Language', 'tg-latn;q=1' );
5849
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() );
6351 }
6452
6553 function testGetPreferredVariantHeaderMulti() {
6654 global $wgRequest;
6755 $wgRequest->setHeader( 'Accept-Language', 'en, tg-latn;q=1' );
6856
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() );
7358 }
7459
7560 function testGetPreferredVariantUserOption() {
@@ -79,10 +64,7 @@
8065 $wgUser->mDataLoaded = true;
8166 $wgUser->setOption( 'variant', 'tg-latn' );
8267
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() );
8769 }
8870
8971 function testGetPreferredVariantHeaderUserVsUrl() {
@@ -94,8 +76,7 @@
9577 $wgUser->setId( 1 );
9678 $wgUser->setOption( 'variant', 'tg-latn' ); // The user's data is ignored
9779 // 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() );
10081 }
10182
10283
@@ -103,10 +84,7 @@
10485 global $wgDefaultLanguageVariant;
10586
10687 $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() );
11189 }
11290
11391 function testGetPreferredVariantDefaultLanguageVsUrlVariant() {
@@ -115,10 +93,7 @@
11694 $wgContLang = Language::factory( 'tg-latn' );
11795 $wgDefaultLanguageVariant = 'tg';
11896 $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() );
12398 }
12499 }
125100

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r756171. Revert the complicated redirection I made in r59754;...philip16:58, 28 October 2010

Status & tagging log