Merge "(bug 33222) Add parentid to revision in export xml"
[lhc/web/wiklou.git] / tests / phpunit / maintenance / backupTextPassTest.php
index 0dade60..6cdba85 100644 (file)
@@ -1,7 +1,6 @@
 <?php
-global $IP;
-require_once( "$IP/maintenance/backup.inc" );
-require_once( "$IP/maintenance/backupTextPass.inc" );
+
+require_once dirname( __FILE__ ) . "/../../../maintenance/backupTextPass.inc";
 
 /**
  * Tests for page dumps of BackupDumper
@@ -73,7 +72,7 @@ class TextPassDumperTest extends DumpTestCase {
 
        }
 
-       protected function setUp() {
+       public function setUp() {
                parent::setUp();
 
                // Since we will restrict dumping by page ranges (to allow
@@ -113,13 +112,13 @@ class TextPassDumperTest extends DumpTestCase {
                $this->assertPageStart( $this->pageId2, NS_MAIN, "BackupDumperTestP2" );
                $this->assertRevision( $this->revId2_1, "BackupDumperTestP2Summary1",
                        $this->textId2_1, false, "jprywrymfhysqllua29tj3sc7z39dl2",
-                       "BackupDumperTestP2Text1" );
+                       "BackupDumperTestP2Text1", $this->revId2_2 );
                $this->assertRevision( $this->revId2_2, "BackupDumperTestP2Summary2",
                        $this->textId2_2, false, "b7vj5ks32po5m1z1t1br4o7scdwwy95",
-                       "BackupDumperTestP2Text2" );
+                       "BackupDumperTestP2Text2", $this->revId2_3 );
                $this->assertRevision( $this->revId2_3, "BackupDumperTestP2Summary3",
                        $this->textId2_3, false, "jfunqmh1ssfb8rs43r19w98k28gg56r",
-                       "BackupDumperTestP2Text3" );
+                       "BackupDumperTestP2Text3", $this->revId2_4 );
                $this->assertRevision( $this->revId2_4, "BackupDumperTestP2Summary4 extra",
                        $this->textId2_4, false, "6o1ciaxa6pybnqprmungwofc4lv00wv",
                        "BackupDumperTestP2Text4 some additional Text" );
@@ -179,15 +178,15 @@ class TextPassDumperTest extends DumpTestCase {
                $this->assertPageStart( $this->pageId2, NS_MAIN, "BackupDumperTestP2" );
                $this->assertRevision( $this->revId2_1, "BackupDumperTestP2Summary1",
                        $this->textId2_1, false, "jprywrymfhysqllua29tj3sc7z39dl2",
-                       "BackupDumperTestP2Text1" );
+                       "BackupDumperTestP2Text1", $this->revId2_2 );
                $this->assertRevision( $this->revId2_2, "BackupDumperTestP2Summary2",
                        $this->textId2_2, false, "b7vj5ks32po5m1z1t1br4o7scdwwy95",
-                       "BackupDumperTestP2Text2" );
+                       "BackupDumperTestP2Text2", $this->revId2_3 );
                // Prefetch kicks in. This is still the SHA-1 of the original text,
                // But the actual text (with different SHA-1) comes from prefetch.
                $this->assertRevision( $this->revId2_3, "BackupDumperTestP2Summary3",
                        $this->textId2_3, false, "jfunqmh1ssfb8rs43r19w98k28gg56r",
-                       "Prefetch_________2Text3" );
+                       "Prefetch_________2Text3", $this->revId2_4 );
                $this->assertRevision( $this->revId2_4, "BackupDumperTestP2Summary4 extra",
                        $this->textId2_4, false, "6o1ciaxa6pybnqprmungwofc4lv00wv",
                        "BackupDumperTestP2Text4 some additional Text" );
@@ -331,13 +330,13 @@ class TextPassDumperTest extends DumpTestCase {
                                        "BackupDumperTestP2" );
                                $this->assertRevision( $this->revId2_1, "BackupDumperTestP2Summary1",
                                        $this->textId2_1, false, "jprywrymfhysqllua29tj3sc7z39dl2",
-                                       "BackupDumperTestP2Text1" );
+                                       "BackupDumperTestP2Text1", $this->revId2_2 );
                                $this->assertRevision( $this->revId2_2, "BackupDumperTestP2Summary2",
                                        $this->textId2_2, false, "b7vj5ks32po5m1z1t1br4o7scdwwy95",
-                                       "BackupDumperTestP2Text2" );
+                                       "BackupDumperTestP2Text2", $this->revId2_3 );
                                $this->assertRevision( $this->revId2_3, "BackupDumperTestP2Summary3",
                                        $this->textId2_3, false, "jfunqmh1ssfb8rs43r19w98k28gg56r",
-                                       "BackupDumperTestP2Text3" );
+                                       "BackupDumperTestP2Text3", $this->revId2_4 );
                                $this->assertRevision( $this->revId2_4,
                                        "BackupDumperTestP2Summary4 extra",
                                        $this->textId2_4, false, "6o1ciaxa6pybnqprmungwofc4lv00wv",
@@ -429,10 +428,10 @@ class TextPassDumperTest extends DumpTestCase {
                if ( $fname === null ) {
                        $fname = $this->getNewTempFile();
                }
-               $header = '<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.6/" '
+               $header = '<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.7/" '
                        . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
-                       . 'xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.6/ '
-                       . 'http://www.mediawiki.org/xml/export-0.6.xsd" version="0.6" xml:lang="en">
+                       . 'xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.7/ '
+                       . 'http://www.mediawiki.org/xml/export-0.7.xsd" version="0.7" xml:lang="en">
   <siteinfo>
     <sitename>wikisvn</sitename>
     <base>http://localhost/wiki-svn/index.php/Main_Page</base>
@@ -478,8 +477,8 @@ class TextPassDumperTest extends DumpTestCase {
         <ip>127.0.0.1</ip>
       </contributor>
       <comment>BackupDumperTestP1Summary1</comment>
-      <text id="' . $this->textId1_1 . '" bytes="23" />
       <sha1>0bolhl6ol7i6x0e7yq91gxgaan39j87</sha1>
+      <text id="' . $this->textId1_1 . '" bytes="23" />
     </revision>
   </page>
 ';
@@ -489,33 +488,36 @@ class TextPassDumperTest extends DumpTestCase {
     <id>' . ( $this->pageId2 + $i * 4 ) . '</id>
     <revision>
       <id>' . $this->revId2_1 . '</id>
+      <parentid>' . $this->revId2_2 . '</parentid>
       <timestamp>2012-04-01T16:46:05Z</timestamp>
       <contributor>
         <ip>127.0.0.1</ip>
       </contributor>
       <comment>BackupDumperTestP2Summary1</comment>
-      <text id="' . $this->textId2_1 . '" bytes="23" />
       <sha1>jprywrymfhysqllua29tj3sc7z39dl2</sha1>
+      <text id="' . $this->textId2_1 . '" bytes="23" />
     </revision>
     <revision>
       <id>' . $this->revId2_2 . '</id>
+      <parentid>' . $this->revId2_3 . '</parentid>
       <timestamp>2012-04-01T16:46:05Z</timestamp>
       <contributor>
         <ip>127.0.0.1</ip>
       </contributor>
       <comment>BackupDumperTestP2Summary2</comment>
-      <text id="' . $this->textId2_2 . '" bytes="23" />
       <sha1>b7vj5ks32po5m1z1t1br4o7scdwwy95</sha1>
+      <text id="' . $this->textId2_2 . '" bytes="23" />
     </revision>
     <revision>
       <id>' . $this->revId2_3 . '</id>
+      <parentid>' . $this->revId2_4 . '</parentid>
       <timestamp>2012-04-01T16:46:05Z</timestamp>
       <contributor>
         <ip>127.0.0.1</ip>
       </contributor>
       <comment>BackupDumperTestP2Summary3</comment>
-      <text id="' . $this->textId2_3 . '" bytes="23" />
       <sha1>jfunqmh1ssfb8rs43r19w98k28gg56r</sha1>
+      <text id="' . $this->textId2_3 . '" bytes="23" />
     </revision>
     <revision>
       <id>' . $this->revId2_4 . '</id>
@@ -524,8 +526,8 @@ class TextPassDumperTest extends DumpTestCase {
         <ip>127.0.0.1</ip>
       </contributor>
       <comment>BackupDumperTestP2Summary4 extra</comment>
-      <text id="' . $this->textId2_4 . '" bytes="44" />
       <sha1>6o1ciaxa6pybnqprmungwofc4lv00wv</sha1>
+      <text id="' . $this->textId2_4 . '" bytes="44" />
     </revision>
   </page>
 ';
@@ -542,8 +544,8 @@ class TextPassDumperTest extends DumpTestCase {
         <ip>127.0.0.1</ip>
       </contributor>
       <comment>Talk BackupDumperTestP1 Summary1</comment>
-      <text id="' . $this->textId4_1 . '" bytes="35" />
       <sha1>nktofwzd0tl192k3zfepmlzxoax1lpe</sha1>
+      <text id="' . $this->textId4_1 . '" bytes="35" />
     </revision>
   </page>
 ';