Merge "Documentation: Remove paragraph about not creating a 2nd WebRequest"
[lhc/web/wiklou.git] / tests / phpunit / maintenance / backup_PageTest.php
index 0cb0cdb..5781d1c 100644 (file)
@@ -6,6 +6,7 @@
  * @group Dump
  * @covers BackupDumper
  */
+
 class BackupDumperPageTest extends DumpTestCase {
 
        // We'll add several pages, revision and texts. The following variables hold the
@@ -98,14 +99,15 @@ class BackupDumperPageTest extends DumpTestCase {
        function testFullTextPlain() {
                // Preparing the dump
                $fname = $this->getNewTempFile();
-               $dumper = new BackupDumper( array( "--output=file:" . $fname ) );
+
+               $dumper = new DumpBackup();
+               $dumper->loadWithArgv( array( '--full', '--quiet', '--output', 'file:' . $fname ) );
                $dumper->startId = $this->pageId1;
                $dumper->endId = $this->pageId4 + 1;
-               $dumper->reporting = false;
                $dumper->setDb( $this->db );
 
                // Performing the dump
-               $dumper->dump( WikiExporter::FULL, WikiExporter::TEXT );
+               $dumper->execute();
 
                // Checking the dumped data
                $this->assertDumpStart( $fname );
@@ -153,14 +155,15 @@ class BackupDumperPageTest extends DumpTestCase {
        function testFullStubPlain() {
                // Preparing the dump
                $fname = $this->getNewTempFile();
-               $dumper = new BackupDumper( array( "--output=file:" . $fname ) );
+
+               $dumper = new DumpBackup();
+               $dumper->loadWithArgv( array( '--full', '--quiet', '--output', 'file:' . $fname, '--stub' ) );
                $dumper->startId = $this->pageId1;
                $dumper->endId = $this->pageId4 + 1;
-               $dumper->reporting = false;
                $dumper->setDb( $this->db );
 
                // Performing the dump
-               $dumper->dump( WikiExporter::FULL, WikiExporter::STUB );
+               $dumper->execute();
 
                // Checking the dumped data
                $this->assertDumpStart( $fname );
@@ -202,7 +205,8 @@ class BackupDumperPageTest extends DumpTestCase {
        function testCurrentStubPlain() {
                // Preparing the dump
                $fname = $this->getNewTempFile();
-               $dumper = new BackupDumper( array( "--output=file:" . $fname ) );
+
+               $dumper = new DumpBackup( array( '--output', 'file:' . $fname ) );
                $dumper->startId = $this->pageId1;
                $dumper->endId = $this->pageId4 + 1;
                $dumper->reporting = false;
@@ -247,7 +251,8 @@ class BackupDumperPageTest extends DumpTestCase {
 
                // Preparing the dump
                $fname = $this->getNewTempFile();
-               $dumper = new BackupDumper( array( "--output=gzip:" . $fname ) );
+
+               $dumper = new DumpBackup( array( '--output', 'gzip:' . $fname ) );
                $dumper->startId = $this->pageId1;
                $dumper->endId = $this->pageId4 + 1;
                $dumper->reporting = false;
@@ -288,24 +293,25 @@ class BackupDumperPageTest extends DumpTestCase {
                $this->assertDumpEnd();
        }
 
+       /**
+        * xmldumps-backup typically performs a single dump that that writes
+        * out three files
+        * - gzipped stubs of everything (meta-history)
+        * - gzipped stubs of latest revisions of all pages (meta-current)
+        * - gzipped stubs of latest revisions of all pages of namespage 0
+        *   (articles)
+        *
+        * We reproduce such a setup with our mini fixture, although we omit
+        * chunks, and all the other gimmicks of xmldumps-backup.
+        */
        function testXmlDumpsBackupUseCase() {
-               // xmldumps-backup typically performs a single dump that that writes
-               // out three files
-               // * gzipped stubs of everything (meta-history)
-               // * gzipped stubs of latest revisions of all pages (meta-current)
-               // * gzipped stubs of latest revisions of all pages of namespage 0
-               //   (articles)
-               //
-               // 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,
+               $dumper = new DumpBackup( array( "--full", "--stub", "--output=gzip:" . $fnameMetaHistory,
                        "--output=gzip:" . $fnameMetaCurrent, "--filter=latest",
                        "--output=gzip:" . $fnameArticles, "--filter=latest",
                        "--filter=notalk", "--filter=namespace:!NS_USER",