From b6fe73db32f55b37072ec2275e405607fc934fc2 Mon Sep 17 00:00:00 2001 From: addshore Date: Fri, 10 Nov 2017 13:46:44 +0000 Subject: [PATCH] Make Revision::testIsUnpatrolled more reliable Bug: T180210 Change-Id: Ib88c39527fafefdaafdb05c944716b5a1449cf1b --- .../includes/RevisionIntegrationTest.php | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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() ); -- 2.20.1