jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/399636 )

Change subject: [MCR] Add test for PageArchive::listRevisions
......................................................................


[MCR] Add test for PageArchive::listRevisions

Change-Id: If4ab58cd889e7166142a9f9a28fc81d776a7db3f
---
M tests/phpunit/includes/PageArchiveTest.php
1 file changed, 59 insertions(+), 1 deletion(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/phpunit/includes/PageArchiveTest.php 
b/tests/phpunit/includes/PageArchiveTest.php
index 6420c39..28991a0 100644
--- a/tests/phpunit/includes/PageArchiveTest.php
+++ b/tests/phpunit/includes/PageArchiveTest.php
@@ -11,8 +11,9 @@
  * ^--- important, causes tests not to fail with timeout
  */
 class PageArchiveTest extends MediaWikiTestCase {
+
        /**
-        * @var WikiPage $archivedPage
+        * @var PageArchive $archivedPage
         */
        private $archivedPage;
 
@@ -107,4 +108,61 @@
                $row = $res->fetchObject();
                $this->assertEquals( IP::toHex( $this->ipEditor ), 
$row->ipc_hex );
        }
+
+       /**
+        * @covers PageArchive::listRevisions
+        */
+       public function testListRevisions() {
+               $revisions = $this->archivedPage->listRevisions();
+               $this->assertEquals( 2, $revisions->numRows() );
+
+               // Get the rows as arrays
+               $row1 = (array)$revisions->current();
+               $row2 = (array)$revisions->next();
+               // Unset the timestamps (we assume they will be right...
+               $this->assertInternalType( 'string', $row1['ar_timestamp'] );
+               $this->assertInternalType( 'string', $row2['ar_timestamp'] );
+               unset( $row1['ar_timestamp'] );
+               unset( $row2['ar_timestamp'] );
+
+               $this->assertEquals(
+                       [
+                               'ar_minor_edit' => '0',
+                               'ar_user' => '0',
+                               'ar_user_text' => 
'2600:387:ed7:947e:8c16:a1ad:dd34:1dd7',
+                               'ar_len' => '11',
+                               'ar_deleted' => '0',
+                               'ar_rev_id' => '3',
+                               'ar_sha1' => '0qdrpxl537ivfnx4gcpnzz0285yxryy',
+                               'ar_page_id' => '2',
+                               'ar_comment_text' => 'just a test',
+                               'ar_comment_data' => null,
+                               'ar_comment_cid' => null,
+                               'ar_content_format' => null,
+                               'ar_content_model' => null,
+                               'ts_tags' => null,
+                       ],
+                       $row1
+               );
+               $this->assertEquals(
+                       [
+                               'ar_minor_edit' => '0',
+                               'ar_user' => '0',
+                               'ar_user_text' => '127.0.0.1',
+                               'ar_len' => '7',
+                               'ar_deleted' => '0',
+                               'ar_rev_id' => '2',
+                               'ar_sha1' => 'pr0s8e18148pxhgjfa0gjrvpy8fiyxc',
+                               'ar_page_id' => '2',
+                               'ar_comment_text' => 'testing',
+                               'ar_comment_data' => null,
+                               'ar_comment_cid' => null,
+                               'ar_content_format' => null,
+                               'ar_content_model' => null,
+                               'ts_tags' => null,
+                       ],
+                       $row2
+               );
+       }
+
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/399636
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If4ab58cd889e7166142a9f9a28fc81d776a7db3f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to