Addshore has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395005 )

Change subject: Test for WikiPge::insertProtectNullRevision
......................................................................

Test for WikiPge::insertProtectNullRevision

Bug: T180989
Change-Id: Iffee0bbe9fb18bb6c7f7af10b6405007468ac0b9
---
M tests/phpunit/includes/page/WikiPageDbTestBase.php
1 file changed, 65 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/05/395005/1

diff --git a/tests/phpunit/includes/page/WikiPageDbTestBase.php 
b/tests/phpunit/includes/page/WikiPageDbTestBase.php
index 50a70d3..3fd5231 100644
--- a/tests/phpunit/includes/page/WikiPageDbTestBase.php
+++ b/tests/phpunit/includes/page/WikiPageDbTestBase.php
@@ -1425,4 +1425,69 @@
                $this->assertNull( WikiPage::newFromID( 73574757437437743743 ) 
);
        }
 
+       public function provideTestInsertProtectNullRevision() {
+               // @codingStandardsIgnoreStart Generic.Files.LineLength
+               yield [
+                       'goat-message-key',
+                       [ 'edit' => 'sysop' ],
+                       [ 'edit' => '20200101040404' ],
+                       false,
+                       'Goat Reason',
+                       true,
+                       '(goat-message-key: 
WikiPageDbTestBase::testInsertProtectNullRevision, 
UTSysop)(colon-separator)Goat Reason(word-separator)(parentheses: 
(protect-summary-desc: (restriction-edit), (protect-level-sysop), 
(protect-expiring: 04:04, 1 (january) 2020, 1 (january) 2020, 04:04)))'
+               ];
+               yield [
+                       'goat-key',
+                       [ 'edit' => 'sysop', 'move' => 'something' ],
+                       [ 'edit' => '20200101040404', 'move' => 
'20210101050505' ],
+                       false,
+                       'Goat Goat',
+                       true,
+                       '(goat-key: 
WikiPageDbTestBase::testInsertProtectNullRevision, 
UTSysop)(colon-separator)Goat Goat(word-separator)(parentheses: 
(protect-summary-desc: (restriction-edit), (protect-level-sysop), 
(protect-expiring: 04:04, 1 (january) 2020, 1 (january) 2020, 
04:04))(word-separator)(protect-summary-desc: (restriction-move), 
(protect-level-something), (protect-expiring: 05:05, 1 (january) 2021, 1 
(january) 2021, 05:05)))'
+               ];
+               // @codingStandardsIgnoreEnd Generic.Files.LineLength
+       }
+
+       /**
+        * @dataProvider provideTestInsertProtectNullRevision
+        * @covers WikiPge::insertProtectNullRevision
+        * @covers WikiPge::protectDescription
+        *
+        * @param $revCommentMsg
+        * @param array $limit
+        * @param array $expiry
+        * @param $cascade
+        * @param $reason
+        * @param bool|null $user true if the test sysop should be used, or null
+        * @param string $expectedComment
+        */
+       public function testInsertProtectNullRevision(
+               $revCommentMsg,
+               array $limit,
+               array $expiry,
+               $cascade,
+               $reason,
+               $user,
+               $expectedComment
+       ) {
+               $this->setContentLang( 'qqx' );
+
+               $page = $this->createPage( __METHOD__, 'Goat' );
+
+               $user = $user === null ? $user : 
$this->getTestSysop()->getUser();
+
+               $result = $page->insertProtectNullRevision(
+                       $revCommentMsg,
+                       $limit,
+                       $expiry,
+                       $cascade,
+                       $reason,
+                       $user
+               );
+
+               $this->assertTrue( $result instanceof Revision );
+               $this->assertSame( $expectedComment, $result->getComment( 
Revision::RAW ) );
+
+       }
+
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iffee0bbe9fb18bb6c7f7af10b6405007468ac0b9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>

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

Reply via email to