From: addshore Date: Sat, 14 Oct 2017 10:17:39 +0000 (+0100) Subject: RevisionIntegrationTest for newFromPageId X-Git-Tag: 1.31.0-rc.0~1756 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=258e7567f59010311cd2776dd14fb991babcef50;p=lhc%2Fweb%2Fwiklou.git RevisionIntegrationTest for newFromPageId Change-Id: I09cf5fcbacab662e30acda1687ebcfe6b29f1900 --- diff --git a/tests/phpunit/includes/RevisionIntegrationTest.php b/tests/phpunit/includes/RevisionIntegrationTest.php index 5d96abf45c..4904f02036 100644 --- a/tests/phpunit/includes/RevisionIntegrationTest.php +++ b/tests/phpunit/includes/RevisionIntegrationTest.php @@ -260,6 +260,46 @@ class RevisionIntegrationTest extends MediaWikiTestCase { $this->assertRevEquals( $orig, $rev ); } + /** + * @covers Revision::newFromPageId + */ + public function testNewFromPageId() { + $rev = Revision::newFromPageId( $this->testPage->getId() ); + $this->assertRevEquals( + $this->testPage->getRevision(), + $rev + ); + } + + /** + * @covers Revision::newFromPageId + */ + public function testNewFromPageIdWithLatestId() { + $rev = Revision::newFromPageId( + $this->testPage->getId(), + $this->testPage->getLatest() + ); + $this->assertRevEquals( + $this->testPage->getRevision(), + $rev + ); + } + + /** + * @covers Revision::newFromPageId + */ + public function testNewFromPageIdWithNotLatestId() { + $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ ); + $rev = Revision::newFromPageId( + $this->testPage->getId(), + $this->testPage->getRevision()->getPrevious()->getId() + ); + $this->assertRevEquals( + $this->testPage->getRevision()->getPrevious(), + $rev + ); + } + /** * @covers Revision::fetchRevision */