From: addshore Date: Thu, 9 Nov 2017 10:36:22 +0000 (+0000) Subject: Add tests for Revision::getTitle X-Git-Tag: 1.31.0-rc.0~1567 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=858067fec39ffb88371fc936a40e4f88e0606ec4 Add tests for Revision::getTitle This method is touched in I4f24e7fbb683cb51f3fd8b250732bae9c7541ba2 hence adding some test coverage now. Change-Id: Ie39a294546d84413bfb716efb27fd2c0321b349b --- diff --git a/tests/phpunit/includes/RevisionIntegrationTest.php b/tests/phpunit/includes/RevisionIntegrationTest.php index 48e00e0e2c..ad211c6a9f 100644 --- a/tests/phpunit/includes/RevisionIntegrationTest.php +++ b/tests/phpunit/includes/RevisionIntegrationTest.php @@ -1046,4 +1046,35 @@ class RevisionIntegrationTest extends MediaWikiTestCase { ); } + /** + * @covers Revision::getTitle + */ + public function testGetTitle_fromExistingRevision() { + $this->assertTrue( + $this->testPage->getTitle()->equals( + $this->testPage->getRevision()->getTitle() + ) + ); + } + + /** + * @covers Revision::getTitle + */ + public function testGetTitle_fromRevisionWhichWillLoadTheTitle() { + $rev = new Revision( [ 'id' => $this->testPage->getLatest() ] ); + $this->assertTrue( + $this->testPage->getTitle()->equals( + $rev->getTitle() + ) + ); + } + + /** + * @covers Revision::getTitle + */ + public function testGetTitle_forBadRevision() { + $rev = new Revision( [] ); + $this->assertNull( $rev->getTitle() ); + } + }