Merge "Add method parameter type documentation"
[lhc/web/wiklou.git] / tests / phpunit / maintenance / DumpTestCase.php
index 40d24fc..163314e 100644 (file)
@@ -60,11 +60,14 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                if ( $gzipped_contents === false ) {
                        $this->fail( "Could not get contents of $fname" );
                }
-               // We resort to use gzinflate instead of gzdecode, as gzdecode
-               // need not be available
-               $contents = gzinflate( substr( $gzipped_contents, 10, -8 ) );
-               $this->assertEquals( strlen( $contents ),
-                       file_put_contents( $fname, $contents ), "# bytes written" );
+
+               $contents = gzdecode( $gzipped_contents );
+
+               $this->assertEquals(
+                       strlen( $contents ),
+                       file_put_contents( $fname, $contents ),
+                       '# bytes written'
+               );
        }
 
        /**
@@ -73,8 +76,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 +84,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                        throw $this->exceptionFromAddDBData;
                }
 
-               $wgUser = new User();
+               $this->setMwGlobals( 'wgUser', new User() );
        }
 
        /**
@@ -126,6 +127,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                                return true;
                        }
                }
+
                return false;
        }
 
@@ -147,6 +149,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                                return true;
                        }
                }
+
                return false;
        }
 
@@ -273,7 +276,6 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                $this->assertTextNode( "title", $name );
                $this->assertTextNode( "ns", $ns );
                $this->assertTextNode( "id", $id );
-
        }
 
        /**
@@ -301,8 +303,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();