Wrong namespace in BackupDumperPageTest::testFullTextPlain
authorumherirrender <umherirrender_de.wp@web.de>
Mon, 31 Dec 2012 12:23:20 +0000 (13:23 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 31 Dec 2012 13:35:45 +0000 (13:35 +0000)
The problem here is, that title objects are created before wgContLang is
changed, so the title can contains wrong namespace names.

1) BackupDumperPageTest::testFullTextPlain
Text of node title
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Diskussion:BackupDumperTestP1'
+'Talk:BackupDumperTestP1'

Change-Id: I975c0f6ae7e6f51b038fe41edda2f54cd8c97eb6

tests/phpunit/maintenance/backup_PageTest.php

index 227e04a..6cdc4ec 100644 (file)
@@ -19,6 +19,12 @@ class BackupDumperPageTest extends DumpTestCase {
        private $namespace, $talk_namespace;
 
        function addDBData() {
+               // be sure, titles created here using english namespace names
+               $this->setMwGlobals( array(
+                       'wgLanguageCode' => 'en',
+                       'wgContLang' => Language::factory( 'en' ),
+               ));
+
                $this->tablesUsed[] = 'page';
                $this->tablesUsed[] = 'revision';
                $this->tablesUsed[] = 'text';
@@ -79,11 +85,6 @@ class BackupDumperPageTest extends DumpTestCase {
        protected function setUp() {
                parent::setUp();
 
-               $this->setMwGlobals( array(
-                       'wgLanguageCode' => 'en',
-                       'wgContLang' => Language::factory( 'en' ),
-               ));
-
                // Since we will restrict dumping by page ranges (to allow
                // working tests, even if the db gets prepopulated by a base
                // class), we have to assert, that the page id are consecutively