Add tests for Revision::getTitle

This method is touched in I4f24e7fbb683cb51f3fd8b250732bae9c7541ba2
hence adding some test coverage now.

Change-Id: Ie39a294546d84413bfb716efb27fd2c0321b349b
This commit is contained in:
addshore 2017-11-09 10:36:22 +00:00
parent 763546fea5
commit 858067fec3

View file

@ -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() );
}
}