X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fjobqueue%2FJobQueueTest.php;h=0421fe7c68d2085761823ba3caec46fe75b80dda;hb=a3cd158d8433e41cbeb299f0e268dfef363b2afd;hp=64dde778185ff8acbadea751b73b34e56e0aba40;hpb=fe4f16a0e10909bcc4b68c3cad8298e5227b679d;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/jobqueue/JobQueueTest.php b/tests/phpunit/includes/jobqueue/JobQueueTest.php index 64dde77818..ce07f78bab 100644 --- a/tests/phpunit/includes/jobqueue/JobQueueTest.php +++ b/tests/phpunit/includes/jobqueue/JobQueueTest.php @@ -31,7 +31,9 @@ class JobQueueTest extends MediaWikiTestCase { $baseConfig = [ 'class' => JobQueueDBSingle::class ]; } $baseConfig['type'] = 'null'; - $baseConfig['wiki'] = wfWikiID(); + $baseConfig['domain'] = WikiMap::getCurrentWikiDbDomain()->getId(); + $baseConfig['stash'] = new HashBagOStuff(); + $baseConfig['wanCache'] = new WANObjectCache( [ 'cache' => new HashBagOStuff() ] ); $variants = [ 'queueRand' => [ 'order' => 'random', 'claimTTL' => 0 ], 'queueRandTTL' => [ 'order' => 'random', 'claimTTL' => 10 ], @@ -75,6 +77,10 @@ class JobQueueTest extends MediaWikiTestCase { $this->markTestSkipped( $desc ); } $this->assertEquals( wfWikiID(), $queue->getWiki(), "Proper wiki ID ($desc)" ); + $this->assertEquals( + WikiMap::getCurrentWikiDbDomain()->getId(), + $queue->getDomain(), + "Proper wiki ID ($desc)" ); } /** @@ -253,8 +259,7 @@ class JobQueueTest extends MediaWikiTestCase { $this->assertEquals( 0, $queue->getSize(), "Queue is empty ($desc)" ); $this->assertEquals( 0, $queue->getAcquiredCount(), "Queue is empty ($desc)" ); - $id = wfRandomString( 32 ); - $root1 = Job::newRootJobParams( "nulljobspam:$id" ); // task ID/timestamp + $root1 = Job::newRootJobParams( "nulljobspam:testId" ); // task ID/timestamp for ( $i = 0; $i < 5; ++$i ) { $this->assertNull( $queue->push( $this->newJob( 0, $root1 ) ), "Push worked ($desc)" ); } @@ -374,12 +379,12 @@ class JobQueueTest extends MediaWikiTestCase { } function newJob( $i = 0, $rootJob = [] ) { - return new NullJob( Title::newMainPage(), + return Job::factory( 'null', Title::newMainPage(), [ 'lives' => 0, 'usleep' => 0, 'removeDuplicates' => 0, 'i' => $i ] + $rootJob ); } function newDedupedJob( $i = 0, $rootJob = [] ) { - return new NullJob( Title::newMainPage(), + return Job::factory( 'null', Title::newMainPage(), [ 'lives' => 0, 'usleep' => 0, 'removeDuplicates' => 1, 'i' => $i ] + $rootJob ); } } @@ -388,6 +393,6 @@ class JobQueueDBSingle extends JobQueueDB { protected function getDB( $index ) { $lb = MediaWikiServices::getInstance()->getDBLoadBalancer(); // Override to not use CONN_TRX_AUTOCOMMIT so that we see the same temporary `job` table - return $lb->getConnection( $index, [], $this->wiki ); + return $lb->getConnection( $index, [], $this->domain ); } }