Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/235468
Change subject: Add test for maxChunks in ChangeDispatcher ...................................................................... Add test for maxChunks in ChangeDispatcher Bug: T105592 Change-Id: Id2578be83a411881a42183fd176021bf1e1acd40 --- M repo/tests/phpunit/includes/ChangeDispatcherTest.php 1 file changed, 30 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/68/235468/3 diff --git a/repo/tests/phpunit/includes/ChangeDispatcherTest.php b/repo/tests/phpunit/includes/ChangeDispatcherTest.php index ed19004..5be8683 100644 --- a/repo/tests/phpunit/includes/ChangeDispatcherTest.php +++ b/repo/tests/phpunit/includes/ChangeDispatcherTest.php @@ -288,6 +288,36 @@ $this->assertEquals( $expectedSeen, $pending[1] ); } + public function testGetPendingChanges_maxChunks() { + $chunkAccess = $this->getMock( 'Wikibase\ChunkAccess' ); + + $chunkAccess->expects( $this->exactly( 1 ) ) + ->method( 'loadChunk' ) + ->will( $this->returnCallback( array( $this, 'getChanges' ) ) ); + + $chunkAccess->expects( $this->any() ) + ->method( 'getRecordId' ) + ->will( $this->returnCallback( function ( Change $change ) { + return $change->getId(); + } ) ); + + $dispatcher = new ChangeDispatcher( + $this->getMock( 'Wikibase\Store\ChangeDispatchCoordinator' ), + $this->getNotificationSender(), + $chunkAccess, + $this->getSubscriptionLookup() + ); + + // 2 changes are loaded in each chunk + $dispatcher->setBatchSize( 2 ); + $dispatcher->setBatchChunkFactor( 1 ); + + // only process 1 chunk + $dispatcher->setMaxChunks( 1 ); + + $pending = $dispatcher->getPendingChanges( 'dewiki', 0 ); + } + public function provideDispatchTo() { $changes = $this->getAllChanges(); -- To view, visit https://gerrit.wikimedia.org/r/235468 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id2578be83a411881a42183fd176021bf1e1acd40 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude <aude.w...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits