Merge "Fix global objects and singletons in NewParserTest"
[lhc/web/wiklou.git] / tests / phpunit / maintenance / DumpTestCase.php
index 106fab8..78a5153 100644 (file)
@@ -73,8 +73,6 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
         * Clears $wgUser, and reports errors from addDBData to PHPUnit
         */
        protected function setUp() {
-               global $wgUser;
-
                parent::setUp();
 
                // Check if any Exception is stored for rethrowing from addDBData
@@ -83,7 +81,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                        throw $this->exceptionFromAddDBData;
                }
 
-               $wgUser = new User();
+               $this->setMwGlobals( 'wgUser', new User() );
        }
 
        /**
@@ -121,10 +119,12 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
        protected function skipToNodeEnd( $name ) {
                while ( $this->xml->read() ) {
                        if ( $this->xml->nodeType == XMLReader::END_ELEMENT &&
-                               $this->xml->name == $name ) {
+                               $this->xml->name == $name
+                       ) {
                                return true;
                        }
                }
+
                return false;
        }
 
@@ -146,6 +146,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                                return true;
                        }
                }
+
                return false;
        }
 
@@ -189,7 +190,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
        protected function skipWhitespace() {
                $cont = true;
                while ( $cont && ( ( $this->xml->nodeType == XMLReader::WHITESPACE )
-                               || ( $this->xml->nodeType == XMLReader::SIGNIFICANT_WHITESPACE ) ) ) {
+                       || ( $this->xml->nodeType == XMLReader::SIGNIFICANT_WHITESPACE ) ) ) {
                        $cont = $this->xml->read();
                }
        }
@@ -272,7 +273,6 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                $this->assertTextNode( "title", $name );
                $this->assertTextNode( "ns", $ns );
                $this->assertTextNode( "id", $id );
-
        }
 
        /**
@@ -300,8 +300,8 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
         * @param $parentid int|false: (optional) id of the parent revision
         */
        protected function assertRevision( $id, $summary, $text_id, $text_bytes, $text_sha1, $text = false, $parentid = false,
-                                               $model = CONTENT_MODEL_WIKITEXT, $format = CONTENT_FORMAT_WIKITEXT ) {
-
+               $model = CONTENT_MODEL_WIKITEXT, $format = CONTENT_FORMAT_WIKITEXT
+       ) {
                $this->assertNodeStart( "revision" );
                $this->skipWhitespace();
 
@@ -358,7 +358,8 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                        $this->assertFalse( $this->xml->hasValue, "Revision has text" );
                        $this->assertTrue( $this->xml->read(), "Skipping text start tag" );
                        if ( ( $this->xml->nodeType == XMLReader::END_ELEMENT )
-                               && ( $this->xml->name == "text" ) ) {
+                               && ( $this->xml->name == "text" )
+                       ) {
 
                                $this->xml->read();
                        }