Merge "[FileBackend] Improved some header related docs."
[lhc/web/wiklou.git] / tests / phpunit / maintenance / backupTextPassTest.php
index f669b26..2ebb351 100644 (file)
@@ -26,16 +26,18 @@ class TextPassDumperTest extends DumpTestCase {
                $this->tablesUsed[] = 'revision';
                $this->tablesUsed[] = 'text';
 
+               $ns = $this->getDefaultWikitextNS();
+
                try {
                        // Simple page
-                       $title = Title::newFromText( 'BackupDumperTestP1' );
+                       $title = Title::newFromText( 'BackupDumperTestP1', $ns );
                        $page = WikiPage::factory( $title );
                        list( $this->revId1_1, $this->textId1_1 ) = $this->addRevision( $page,
                                "BackupDumperTestP1Text1", "BackupDumperTestP1Summary1" );
                        $this->pageId1 = $page->getId();
 
                        // Page with more than one revision
-                       $title = Title::newFromText( 'BackupDumperTestP2' );
+                       $title = Title::newFromText( 'BackupDumperTestP2', $ns );
                        $page = WikiPage::factory( $title );
                        list( $this->revId2_1, $this->textId2_1 ) = $this->addRevision( $page,
                                "BackupDumperTestP2Text1", "BackupDumperTestP2Summary1" );
@@ -49,7 +51,7 @@ class TextPassDumperTest extends DumpTestCase {
                        $this->pageId2 = $page->getId();
 
                        // Deleted page.
-                       $title = Title::newFromText( 'BackupDumperTestP3' );
+                       $title = Title::newFromText( 'BackupDumperTestP3', $ns );
                        $page = WikiPage::factory( $title );
                        list( $this->revId3_1, $this->textId3_1 ) = $this->addRevision( $page,
                                "BackupDumperTestP3Text1", "BackupDumperTestP2Summary1" );
@@ -59,6 +61,13 @@ class TextPassDumperTest extends DumpTestCase {
                        $page->doDeleteArticle( "Testing ;)" );
 
                        // Page from non-default namespace
+
+                       if ( $ns === NS_TALK ) {
+                               //@todo: work around this.
+                               throw new MWException( "The default wikitext namespace is the talk namespace. "
+                                       . " We can't currently deal with that.");
+                       }
+
                        $title = Title::newFromText( 'BackupDumperTestP1', NS_TALK );
                        $page = WikiPage::factory( $title );
                        list( $this->revId4_1, $this->textId4_1 ) = $this->addRevision( $page,
@@ -74,7 +83,7 @@ class TextPassDumperTest extends DumpTestCase {
 
        }
 
-       public function setUp() {
+       protected function setUp() {
                parent::setUp();
 
                // Since we will restrict dumping by page ranges (to allow
@@ -250,9 +259,9 @@ class TextPassDumperTest extends DumpTestCase {
                        $dumper->stderr = $stderr;
 
                        // The actual dump and taking time
-                       $ts_before = wfTime();
+                       $ts_before = microtime( true );
                        $dumper->dump( WikiExporter::FULL, WikiExporter::TEXT );
-                       $ts_after = wfTime();
+                       $ts_after = microtime( true );
                        $lastDuration = $ts_after - $ts_before;
 
                        // Handling increasing the iteration count for the stubs
@@ -383,7 +392,7 @@ class TextPassDumperTest extends DumpTestCase {
                $this->assertEmpty( $files, "Remaining unchecked files" );
 
                // ... and have dealt with more than one checkpoint file
-               $this->assertGreaterThan( 1, $checkpointFiles, "# of checkpoint files" );
+               $this->assertGreaterThan( 1, $checkpointFiles, "expected more than 1 checkpoint to have been created. Checkpoint interval is $checkpointAfter seconds, maybe your computer is too fast?" );
 
                $this->expectETAOutput();
        }
@@ -438,7 +447,7 @@ class TextPassDumperTest extends DumpTestCase {
   <siteinfo>
     <sitename>wikisvn</sitename>
     <base>http://localhost/wiki-svn/index.php/Main_Page</base>
-    <generator>MediaWiki 1.20alpha</generator>
+    <generator>MediaWiki 1.21alpha</generator>
     <case>first-letter</case>
     <namespaces>
       <namespace key="-2" case="first-letter">Media</namespace>
@@ -481,6 +490,8 @@ class TextPassDumperTest extends DumpTestCase {
       </contributor>
       <comment>BackupDumperTestP1Summary1</comment>
       <sha1>0bolhl6ol7i6x0e7yq91gxgaan39j87</sha1>
+      <model>wikitext</model>
+      <format>text/x-wiki</format>
       <text id="' . $this->textId1_1 . '" bytes="23" />
     </revision>
   </page>
@@ -497,6 +508,8 @@ class TextPassDumperTest extends DumpTestCase {
       </contributor>
       <comment>BackupDumperTestP2Summary1</comment>
       <sha1>jprywrymfhysqllua29tj3sc7z39dl2</sha1>
+      <model>wikitext</model>
+      <format>text/x-wiki</format>
       <text id="' . $this->textId2_1 . '" bytes="23" />
     </revision>
     <revision>
@@ -508,6 +521,8 @@ class TextPassDumperTest extends DumpTestCase {
       </contributor>
       <comment>BackupDumperTestP2Summary2</comment>
       <sha1>b7vj5ks32po5m1z1t1br4o7scdwwy95</sha1>
+      <model>wikitext</model>
+      <format>text/x-wiki</format>
       <text id="' . $this->textId2_2 . '" bytes="23" />
     </revision>
     <revision>
@@ -519,6 +534,8 @@ class TextPassDumperTest extends DumpTestCase {
       </contributor>
       <comment>BackupDumperTestP2Summary3</comment>
       <sha1>jfunqmh1ssfb8rs43r19w98k28gg56r</sha1>
+      <model>wikitext</model>
+      <format>text/x-wiki</format>
       <text id="' . $this->textId2_3 . '" bytes="23" />
     </revision>
     <revision>
@@ -530,6 +547,8 @@ class TextPassDumperTest extends DumpTestCase {
       </contributor>
       <comment>BackupDumperTestP2Summary4 extra</comment>
       <sha1>6o1ciaxa6pybnqprmungwofc4lv00wv</sha1>
+      <model>wikitext</model>
+      <format>text/x-wiki</format>
       <text id="' . $this->textId2_4 . '" bytes="44" />
     </revision>
   </page>
@@ -548,6 +567,8 @@ class TextPassDumperTest extends DumpTestCase {
       </contributor>
       <comment>Talk BackupDumperTestP1 Summary1</comment>
       <sha1>nktofwzd0tl192k3zfepmlzxoax1lpe</sha1>
+      <model>wikitext</model>
+      <format>text/x-wiki</format>
       <text id="' . $this->textId4_1 . '" bytes="35" />
     </revision>
   </page>