Addshore has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/390215 )
Change subject: Add tests for Revision::getParentLengths ...................................................................... Add tests for Revision::getParentLengths This method name is quite missleading as it doesnt get the parent lengths at all, it gets the lengths of the rev ids that you ask for...... This method is touched in I4f24e7fbb683cb51f3fd8b250732bae9c7541ba2 hence adding some test coverage now. Change-Id: Ic837bd60a34341860c4d2287a1b999f40d4f95f1 --- M tests/phpunit/includes/RevisionIntegrationTest.php 1 file changed, 52 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/15/390215/1 diff --git a/tests/phpunit/includes/RevisionIntegrationTest.php b/tests/phpunit/includes/RevisionIntegrationTest.php index 96ce766..4614439 100644 --- a/tests/phpunit/includes/RevisionIntegrationTest.php +++ b/tests/phpunit/includes/RevisionIntegrationTest.php @@ -991,4 +991,56 @@ ); } + /** + * @covers Revision::getParentLengths + */ + public function testGetParentLengths_noRevIds() { + $this->assertSame( + [], + Revision::getParentLengths( + wfGetDB( DB_MASTER ), + [] + ) + ); + } + + /** + * @covers Revision::getParentLengths + */ + public function testGetParentLengths_oneRevId() { + $text[37] = '831jr091jr0921kr21kr0921kjr0921j09rj1'; + + $this->testPage->doEditContent( new WikitextContent( $text[37] ), __METHOD__ ); + $rev[1] = $this->testPage->getLatest(); + + $this->assertSame( + [ $rev[1] => '37' ], + Revision::getParentLengths( + wfGetDB( DB_MASTER ), + [ $rev[1] ] + ) + ); + } + + /** + * @covers Revision::getParentLengths + */ + public function testGetParentLengths_multipleRevIds() { + $text[37] = '831jr091jr0921kr21kr0921kjr0921j09rj1'; + $text[22] = '831jr091jr092121j09rj1'; + + $this->testPage->doEditContent( new WikitextContent( $text[37] ), __METHOD__ ); + $rev[1] = $this->testPage->getLatest(); + $this->testPage->doEditContent( new WikitextContent( $text[22] ), __METHOD__ ); + $rev[2] = $this->testPage->getLatest(); + + $this->assertSame( + [ $rev[1] => '37', $rev[2] => '22' ], + Revision::getParentLengths( + wfGetDB( DB_MASTER ), + [ $rev[1], $rev[2] ] + ) + ); + } + } -- To view, visit https://gerrit.wikimedia.org/r/390215 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic837bd60a34341860c4d2287a1b999f40d4f95f1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Addshore <addshorew...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits