From: addshore Date: Fri, 10 Nov 2017 13:46:44 +0000 (+0000) Subject: Make Revision::testIsUnpatrolled more reliable X-Git-Tag: 1.31.0-rc.0~1554 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=b6fe73db32f55b37072ec2275e405607fc934fc2;p=lhc%2Fweb%2Fwiklou.git Make Revision::testIsUnpatrolled more reliable Bug: T180210 Change-Id: Ib88c39527fafefdaafdb05c944716b5a1449cf1b --- diff --git a/tests/phpunit/includes/RevisionIntegrationTest.php b/tests/phpunit/includes/RevisionIntegrationTest.php index 403983c6cc..b5fa030d4f 100644 --- a/tests/phpunit/includes/RevisionIntegrationTest.php +++ b/tests/phpunit/includes/RevisionIntegrationTest.php @@ -1184,11 +1184,29 @@ class RevisionIntegrationTest extends MediaWikiTestCase { } /** - * This is a simple blanket test for all simple getters and is methods to provide some - * coverage before the split of Revision into multiple classes for MCR work. * @covers Revision::isUnpatrolled */ - public function testIsUnpatrolled_true() { + public function testIsUnpatrolled_returnsRecentChangesId() { + $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ ); + $rev = $this->testPage->getRevision(); + + $this->assertGreaterThan( 0, $rev->isUnpatrolled() ); + $this->assertSame( $rev->getRecentChange()->getAttribute( 'rc_id' ), $rev->isUnpatrolled() ); + } + + /** + * @covers Revision::isUnpatrolled + */ + public function testIsUnpatrolled_returnsZeroIfPatrolled() { + // This assumes that sysops are auto patrolled + $sysop = $this->getTestSysop()->getUser(); + $this->testPage->doEditContent( + new WikitextContent( __METHOD__ ), + __METHOD__, + 0, + false, + $sysop + ); $rev = $this->testPage->getRevision(); $this->assertSame( 0, $rev->isUnpatrolled() );