aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes
diff options
context:
space:
mode:
authorDannyS712 <DannyS712.enwiki@gmail.com>2020-06-30 10:48:24 +0000
committerDannyS712 <DannyS712.enwiki@gmail.com>2020-06-30 10:56:10 +0000
commit66f932e93b633710f4ffb424c059704469cf4336 (patch)
tree86126873465407a57dacb29a392afcb5fe651814 /tests/phpunit/includes
parent20bf602bf1f5ca7a2f4106eea5dd01bc76c26f0c (diff)
downloadmediawikicore-66f932e93b633710f4ffb424c059704469cf4336.tar.gz
mediawikicore-66f932e93b633710f4ffb424c059704469cf4336.zip
Tests: Reduce use of Revision objects
Rather than hiding deprecations, where possible use the RevisionRecord This does not apply to tests explicitly meant to be testing Revision methods Bug: T246284 Change-Id: Ic3d85a9d451c0c2ab5df35764186e7c383fdabec
Diffstat (limited to 'tests/phpunit/includes')
-rw-r--r--tests/phpunit/includes/page/PageArchiveTest.php11
-rw-r--r--tests/phpunit/includes/page/WikiPageDbTest.php20
2 files changed, 13 insertions, 18 deletions
diff --git a/tests/phpunit/includes/page/PageArchiveTest.php b/tests/phpunit/includes/page/PageArchiveTest.php
index 9652f04004fe..b75afb7894b2 100644
--- a/tests/phpunit/includes/page/PageArchiveTest.php
+++ b/tests/phpunit/includes/page/PageArchiveTest.php
@@ -317,12 +317,11 @@ class PageArchiveTest extends MediaWikiTestCase {
* @covers PageArchive::getRevision
*/
public function testGetRevision() {
- $this->hideDeprecated( 'Revision::getPage' );
$this->hideDeprecated( 'PageArchive::getRevision' );
$rev = $this->archivedPage->getRevision( $this->ipRev->getTimestamp() );
$this->assertNotNull( $rev );
- $this->assertSame( $this->pageId, $rev->getPage() );
+ $this->assertSame( $this->pageId, $rev->getRevisionRecord()->getPageId() );
$rev = $this->archivedPage->getRevision( '22991212115555' );
$this->assertNull( $rev );
@@ -346,14 +345,14 @@ class PageArchiveTest extends MediaWikiTestCase {
* @covers PageArchive::getArchivedRevision
*/
public function testGetArchivedRevision() {
- $this->hideDeprecated( 'Revision::getPage' );
- $this->hideDeprecated( 'Revision::getTimestamp' );
$this->hideDeprecated( 'PageArchive::getArchivedRevision' );
$rev = $this->archivedPage->getArchivedRevision( $this->ipRev->getId() );
$this->assertNotNull( $rev );
- $this->assertSame( $this->ipRev->getTimestamp(), $rev->getTimestamp() );
- $this->assertSame( $this->pageId, $rev->getPage() );
+
+ $revRecord = $rev->getRevisionRecord();
+ $this->assertSame( $this->ipRev->getTimestamp(), $revRecord->getTimestamp() );
+ $this->assertSame( $this->pageId, $revRecord->getPageId() );
$rev = $this->archivedPage->getArchivedRevision( 632546 );
$this->assertNull( $rev );
diff --git a/tests/phpunit/includes/page/WikiPageDbTest.php b/tests/phpunit/includes/page/WikiPageDbTest.php
index a9314f8e4408..1762ff1f7e5f 100644
--- a/tests/phpunit/includes/page/WikiPageDbTest.php
+++ b/tests/phpunit/includes/page/WikiPageDbTest.php
@@ -1220,8 +1220,6 @@ more stuff
*/
public function testDoRollback() {
$this->hideDeprecated( 'Revision::countByPageId' );
- $this->hideDeprecated( 'Revision::getSha1' );
- $this->hideDeprecated( 'WikiPage::getRevision' );
$this->hideDeprecated( 'Revision::getUserText' );
$admin = $this->getTestSysop()->getUser();
@@ -1285,12 +1283,14 @@ more stuff
}
$page = new WikiPage( $page->getTitle() );
- $this->assertEquals( $rev2->getSha1(), $page->getRevision()->getSha1(),
+ $this->assertEquals(
+ $rev2->getRevisionRecord()->getSha1(),
+ $page->getRevisionRecord()->getSha1(),
"rollback did not revert to the correct revision" );
$this->assertEquals( "one\n\ntwo", $page->getContent()->getText() );
$rc = MediaWikiServices::getInstance()->getRevisionStore()->getRecentChange(
- $page->getRevision()->getRevisionRecord()
+ $page->getRevisionRecord()
);
$this->assertNotNull( $rc, 'RecentChanges entry' );
@@ -2014,18 +2014,16 @@ more stuff
* @covers WikiPage::updateIfNewerOn
*/
public function testUpdateIfNewerOn_olderRevision() {
- $this->hideDeprecated( 'Revision::getTimestamp' );
$this->hideDeprecated( 'Revision::__construct with an array' );
- $this->hideDeprecated( 'WikiPage::getRevision' );
$this->hideDeprecated( 'WikiPage::updateIfNewerOn' );
$user = $this->getTestSysop()->getUser();
$page = $this->createPage( __METHOD__, 'StartText' );
- $initialRevision = $page->getRevision();
+ $initialRevisionRecord = $page->getRevisionRecord();
$olderTimeStamp = wfTimestamp(
TS_MW,
- wfTimestamp( TS_UNIX, $initialRevision->getTimestamp() ) - 1
+ wfTimestamp( TS_UNIX, $initialRevisionRecord->getTimestamp() ) - 1
);
$olderRevision = new Revision(
@@ -2053,18 +2051,16 @@ more stuff
* @covers WikiPage::updateIfNewerOn
*/
public function testUpdateIfNewerOn_newerRevision() {
- $this->hideDeprecated( 'Revision::getTimestamp' );
$this->hideDeprecated( 'Revision::__construct with an array' );
- $this->hideDeprecated( 'WikiPage::getRevision' );
$this->hideDeprecated( 'WikiPage::updateIfNewerOn' );
$user = $this->getTestSysop()->getUser();
$page = $this->createPage( __METHOD__, 'StartText' );
- $initialRevision = $page->getRevision();
+ $initialRevisionRecord = $page->getRevisionRecord();
$newerTimeStamp = wfTimestamp(
TS_MW,
- wfTimestamp( TS_UNIX, $initialRevision->getTimestamp() ) + 1
+ wfTimestamp( TS_UNIX, $initialRevisionRecord->getTimestamp() ) + 1
);
$newerRevision = new Revision(