From f01c89b786cdf6b0825421a97333b1d697b38d9d Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 16 Jun 2012 09:09:27 +0200 Subject: [PATCH] ensure unique revision id in backupTextPassTest Idb82fe620c3395acaa8f051b4d4d0d770cd33d44 adds a unique contraints on the revision id to export.xsd, which does not apply here creating unique contraints in the same way than the pageids by adding an offset Change-Id: Ia19f1011a5c0ba8d21cc01a9be2e4d2ed300a80a --- .../maintenance/backupTextPassTest.php | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/tests/phpunit/maintenance/backupTextPassTest.php b/tests/phpunit/maintenance/backupTextPassTest.php index 6cdba85d89..8b5928dca8 100644 --- a/tests/phpunit/maintenance/backupTextPassTest.php +++ b/tests/phpunit/maintenance/backupTextPassTest.php @@ -12,12 +12,14 @@ class TextPassDumperTest extends DumpTestCase { // We'll add several pages, revision and texts. The following variables hold the // corresponding ids. - private $pageId1, $pageId2, $pageId3, $pageId4, $pageId5; + private $pageId1, $pageId2, $pageId3, $pageId4; + private static $numOfPages = 4; private $revId1_1, $textId1_1; private $revId2_1, $textId2_1, $revId2_2, $textId2_2; private $revId2_3, $textId2_3, $revId2_4, $textId2_4; private $revId3_1, $textId3_1, $revId3_2, $textId3_2; private $revId4_1, $textId4_1; + private static $numOfRevs = 8; function addDBData() { $this->tablesUsed[] = 'page'; @@ -314,9 +316,9 @@ class TextPassDumperTest extends DumpTestCase { switch ( $lookingForPage ) { case 1: // Page 1 - $this->assertPageStart( $this->pageId1 + $i * 4, NS_MAIN, + $this->assertPageStart( $this->pageId1 + $i * self::$numOfPages, NS_MAIN, "BackupDumperTestP1" ); - $this->assertRevision( $this->revId1_1, "BackupDumperTestP1Summary1", + $this->assertRevision( $this->revId1_1 + $i * self::$numOfRevs, "BackupDumperTestP1Summary1", $this->textId1_1, false, "0bolhl6ol7i6x0e7yq91gxgaan39j87", "BackupDumperTestP1Text1" ); $this->assertPageEnd(); @@ -326,18 +328,18 @@ class TextPassDumperTest extends DumpTestCase { case 2: // Page 2 - $this->assertPageStart( $this->pageId2 + $i * 4, NS_MAIN, + $this->assertPageStart( $this->pageId2 + $i * self::$numOfPages, NS_MAIN, "BackupDumperTestP2" ); - $this->assertRevision( $this->revId2_1, "BackupDumperTestP2Summary1", + $this->assertRevision( $this->revId2_1 + $i * self::$numOfRevs, "BackupDumperTestP2Summary1", $this->textId2_1, false, "jprywrymfhysqllua29tj3sc7z39dl2", - "BackupDumperTestP2Text1", $this->revId2_2 ); - $this->assertRevision( $this->revId2_2, "BackupDumperTestP2Summary2", + "BackupDumperTestP2Text1", $this->revId2_2 + $i * self::$numOfRevs ); + $this->assertRevision( $this->revId2_2 + $i * self::$numOfRevs, "BackupDumperTestP2Summary2", $this->textId2_2, false, "b7vj5ks32po5m1z1t1br4o7scdwwy95", - "BackupDumperTestP2Text2", $this->revId2_3 ); - $this->assertRevision( $this->revId2_3, "BackupDumperTestP2Summary3", + "BackupDumperTestP2Text2", $this->revId2_3 + $i * self::$numOfRevs ); + $this->assertRevision( $this->revId2_3 + $i * self::$numOfRevs, "BackupDumperTestP2Summary3", $this->textId2_3, false, "jfunqmh1ssfb8rs43r19w98k28gg56r", - "BackupDumperTestP2Text3", $this->revId2_4 ); - $this->assertRevision( $this->revId2_4, + "BackupDumperTestP2Text3", $this->revId2_4 + $i * self::$numOfRevs ); + $this->assertRevision( $this->revId2_4 + $i * self::$numOfRevs, "BackupDumperTestP2Summary4 extra", $this->textId2_4, false, "6o1ciaxa6pybnqprmungwofc4lv00wv", "BackupDumperTestP2Text4 some additional Text" ); @@ -348,9 +350,9 @@ class TextPassDumperTest extends DumpTestCase { case 4: // Page 4 - $this->assertPageStart( $this->pageId4 + $i * 4, NS_TALK, + $this->assertPageStart( $this->pageId4 + $i * self::$numOfPages, NS_TALK, "Talk:BackupDumperTestP1" ); - $this->assertRevision( $this->revId4_1, + $this->assertRevision( $this->revId4_1 + $i * self::$numOfRevs, "Talk BackupDumperTestP1 Summary1", $this->textId4_1, false, "nktofwzd0tl192k3zfepmlzxoax1lpe", "Talk about BackupDumperTestP1 Text1" ); @@ -469,9 +471,9 @@ class TextPassDumperTest extends DumpTestCase { $page1 = ' BackupDumperTestP1 0 - ' . ( $this->pageId1 + $i * 4 ) . ' + ' . ( $this->pageId1 + $i * self::$numOfPages ) . ' - ' . $this->revId1_1 . ' + ' . ( $this->revId1_1 + $i * self::$numOfRevs ) . ' 2012-04-01T16:46:05Z 127.0.0.1 @@ -485,10 +487,10 @@ class TextPassDumperTest extends DumpTestCase { $page2 = ' BackupDumperTestP2 0 - ' . ( $this->pageId2 + $i * 4 ) . ' + ' . ( $this->pageId2 + $i * self::$numOfPages ) . ' - ' . $this->revId2_1 . ' - ' . $this->revId2_2 . ' + ' . ( $this->revId2_1 + $i * self::$numOfRevs ) . ' + ' . ( $this->revId2_2 + $i * self::$numOfRevs ) . ' 2012-04-01T16:46:05Z 127.0.0.1 @@ -498,8 +500,8 @@ class TextPassDumperTest extends DumpTestCase { - ' . $this->revId2_2 . ' - ' . $this->revId2_3 . ' + ' . ( $this->revId2_2 + $i * self::$numOfRevs ) . ' + ' . ( $this->revId2_3 + $i * self::$numOfRevs ) . ' 2012-04-01T16:46:05Z 127.0.0.1 @@ -509,8 +511,8 @@ class TextPassDumperTest extends DumpTestCase { - ' . $this->revId2_3 . ' - ' . $this->revId2_4 . ' + ' . ( $this->revId2_3 + $i * self::$numOfRevs ) . ' + ' . ( $this->revId2_4 + $i * self::$numOfRevs ) . ' 2012-04-01T16:46:05Z 127.0.0.1 @@ -520,7 +522,7 @@ class TextPassDumperTest extends DumpTestCase { - ' . $this->revId2_4 . ' + ' . ( $this->revId2_4 + $i * self::$numOfRevs ) . ' 2012-04-01T16:46:05Z 127.0.0.1 @@ -536,9 +538,9 @@ class TextPassDumperTest extends DumpTestCase { $page4 = ' Talk:BackupDumperTestP1 1 - ' . ( $this->pageId4 + $i * 4 ) . ' + ' . ( $this->pageId4 + $i * self::$numOfPages ) . ' - ' . $this->revId4_1 . ' + ' . ( $this->revId4_1 + $i * self::$numOfRevs ) . ' 2012-04-01T16:46:05Z 127.0.0.1 -- 2.20.1