Merge "Fix global objects and singletons in NewParserTest"
[lhc/web/wiklou.git] / tests / phpunit / maintenance / backup_PageTest.php
index 6cdc4ec..99bd270 100644 (file)
@@ -23,7 +23,7 @@ class BackupDumperPageTest extends DumpTestCase {
                $this->setMwGlobals( array(
                        'wgLanguageCode' => 'en',
                        'wgContLang' => Language::factory( 'en' ),
-               ));
+               ) );
 
                $this->tablesUsed[] = 'page';
                $this->tablesUsed[] = 'revision';
@@ -34,9 +34,9 @@ class BackupDumperPageTest extends DumpTestCase {
                        $this->talk_namespace = NS_TALK;
 
                        if ( $this->namespace === $this->talk_namespace ) {
-                               //@todo: work around this.
+                               // @todo work around this.
                                throw new MWException( "The default wikitext namespace is the talk namespace. "
-                                       . " We can't currently deal with that.");
+                                       . " We can't currently deal with that." );
                        }
 
                        $this->pageTitle1 = Title::newFromText( 'BackupDumperTestP1', $this->namespace );
@@ -79,7 +79,6 @@ class BackupDumperPageTest extends DumpTestCase {
                        // DumpTestCase
                        $this->exceptionFromAddDBData = $e;
                }
-
        }
 
        protected function setUp() {
@@ -93,13 +92,12 @@ class BackupDumperPageTest extends DumpTestCase {
                        array( $this->pageId2, $this->pageId3, $this->pageId4 ),
                        array( $this->pageId1 + 1, $this->pageId2 + 1, $this->pageId3 + 1 ),
                        "Page ids increasing without holes" );
-
        }
 
-       function testFullTextPlain () {
+       function testFullTextPlain() {
                // Preparing the dump
                $fname = $this->getNewTempFile();
-               $dumper = new BackupDumper( array ( "--output=file:" . $fname ) );
+               $dumper = new BackupDumper( array( "--output=file:" . $fname ) );
                $dumper->startId = $this->pageId1;
                $dumper->endId = $this->pageId4 + 1;
                $dumper->reporting = false;
@@ -147,10 +145,10 @@ class BackupDumperPageTest extends DumpTestCase {
                $this->assertDumpEnd();
        }
 
-       function testFullStubPlain () {
+       function testFullStubPlain() {
                // Preparing the dump
                $fname = $this->getNewTempFile();
-               $dumper = new BackupDumper( array ( "--output=file:" . $fname ) );
+               $dumper = new BackupDumper( array( "--output=file:" . $fname ) );
                $dumper->startId = $this->pageId1;
                $dumper->endId = $this->pageId4 + 1;
                $dumper->reporting = false;
@@ -192,10 +190,10 @@ class BackupDumperPageTest extends DumpTestCase {
                $this->assertDumpEnd();
        }
 
-       function testCurrentStubPlain () {
+       function testCurrentStubPlain() {
                // Preparing the dump
                $fname = $this->getNewTempFile();
-               $dumper = new BackupDumper( array ( "--output=file:" . $fname ) );
+               $dumper = new BackupDumper( array( "--output=file:" . $fname ) );
                $dumper->startId = $this->pageId1;
                $dumper->endId = $this->pageId4 + 1;
                $dumper->reporting = false;
@@ -231,10 +229,12 @@ class BackupDumperPageTest extends DumpTestCase {
                $this->assertDumpEnd();
        }
 
-       function testCurrentStubGzip () {
+       function testCurrentStubGzip() {
+               $this->checkHasGzip();
+
                // Preparing the dump
                $fname = $this->getNewTempFile();
-               $dumper = new BackupDumper( array ( "--output=gzip:" . $fname ) );
+               $dumper = new BackupDumper( array( "--output=gzip:" . $fname ) );
                $dumper->startId = $this->pageId1;
                $dumper->endId = $this->pageId4 + 1;
                $dumper->reporting = false;
@@ -272,8 +272,7 @@ class BackupDumperPageTest extends DumpTestCase {
        }
 
 
-
-       function testXmlDumpsBackupUseCase () {
+       function testXmlDumpsBackupUseCase() {
                // xmldumps-backup typically performs a single dump that that writes
                // out three files
                // * gzipped stubs of everything (meta-history)
@@ -284,15 +283,17 @@ class BackupDumperPageTest extends DumpTestCase {
                // We reproduce such a setup with our mini fixture, although we omit
                // chunks, and all the other gimmicks of xmldumps-backup.
                //
+               $this->checkHasGzip();
+
                $fnameMetaHistory = $this->getNewTempFile();
                $fnameMetaCurrent = $this->getNewTempFile();
                $fnameArticles = $this->getNewTempFile();
 
-               $dumper = new BackupDumper( array ( "--output=gzip:" . $fnameMetaHistory,
-                               "--output=gzip:" . $fnameMetaCurrent, "--filter=latest",
-                               "--output=gzip:" . $fnameArticles, "--filter=latest",
-                               "--filter=notalk", "--filter=namespace:!NS_USER",
-                               "--reporting=1000" ) );
+               $dumper = new BackupDumper( array( "--output=gzip:" . $fnameMetaHistory,
+                       "--output=gzip:" . $fnameMetaCurrent, "--filter=latest",
+                       "--output=gzip:" . $fnameArticles, "--filter=latest",
+                       "--filter=notalk", "--filter=namespace:!NS_USER",
+                       "--reporting=1000" ) );
                $dumper->startId = $this->pageId1;
                $dumper->endId = $this->pageId4 + 1;
                $dumper->setDb( $this->db );
@@ -302,7 +303,7 @@ class BackupDumperPageTest extends DumpTestCase {
                // computer. We only check that reporting does not crash the dumping
                // and that something is reported
                $dumper->stderr = fopen( 'php://output', 'a' );
-               if ( $dumper->stderr === FALSE ) {
+               if ( $dumper->stderr === false ) {
                        $this->fail( "Could not open stream for stderr" );
                }
 
@@ -400,7 +401,4 @@ class BackupDumperPageTest extends DumpTestCase {
 
                $this->expectETAOutput();
        }
-
-
-
 }