summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/tests/phpunit/TTMServerMessageUpdateJobTest.php')
-rw-r--r--MLEB/Translate/tests/phpunit/TTMServerMessageUpdateJobTest.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/MLEB/Translate/tests/phpunit/TTMServerMessageUpdateJobTest.php b/MLEB/Translate/tests/phpunit/TTMServerMessageUpdateJobTest.php
index 7cc478c0..e0676dbc 100644
--- a/MLEB/Translate/tests/phpunit/TTMServerMessageUpdateJobTest.php
+++ b/MLEB/Translate/tests/phpunit/TTMServerMessageUpdateJobTest.php
@@ -1,24 +1,21 @@
<?php
/**
- * Tests for TTMServerMessageUpdateJob
- *
* @file
* @author David Causse
* @license GPL-2.0-or-later
*/
/**
- * Unit test for TTMServerMessageUpdateJob.
* Mostly test mirroring and failure modes.
*/
-class TTMServerMessageUpdateJobTest extends MediaWikiTestCase {
+class TTMServerMessageUpdateJobTest extends MediaWikiIntegrationTestCase {
/**
* @var WritableTTMServer[] used to link our mocks with TestableTTMServer built by the
* factory
*/
public static $mockups = [];
- public function setUp() {
+ public function setUp() : void {
parent::setUp();
self::$mockups = [];
$this->setMwGlobals( [
@@ -39,7 +36,7 @@ class TTMServerMessageUpdateJobTest extends MediaWikiTestCase {
] );
}
- public function tearDown() {
+ public function tearDown() : void {
parent::tearDown();
self::$mockups = [];
}
@@ -96,7 +93,7 @@ class TTMServerMessageUpdateJobTest extends MediaWikiTestCase {
->getMock()
);
$job->run();
- $this->assertEquals( 1, count( $job->getResentJobs() ) );
+ $this->assertSame( 1, count( $job->getResentJobs() ) );
$expectedParams = [
'errorCount' => 1,
'service' => 'secondary',
@@ -252,7 +249,7 @@ class TTMServerMessageUpdateJobTest extends MediaWikiTestCase {
->getMock()
);
$job->run();
- $this->assertEquals( 1, count( $job->getResentJobs() ) );
+ $this->assertSame( 1, count( $job->getResentJobs() ) );
$expectedParams = [
'errorCount' => 0,
'retryCount' => 1,
@@ -360,7 +357,7 @@ class TTMServerMessageUpdateJobTest extends MediaWikiTestCase {
->getMock()
);
$job->run();
- $this->assertEquals( 0, count( $job->getResentJobs() ) );
+ $this->assertCount( 0, $job->getResentJobs() );
}
}
@@ -373,10 +370,12 @@ class TTMServerMessageUpdateJobTest extends MediaWikiTestCase {
class TestableTTMServerMessageUpdateJob extends TTMServerMessageUpdateJob {
private $resentJobs = [];
private $handleMock;
+
public function __construct( Title $title, $params, $handleMock ) {
parent::__construct( $title, $params );
$this->handleMock = $handleMock;
}
+
public function resend( TTMServerMessageUpdateJob $job ) {
$this->resentJobs[] = $job;
}
@@ -402,6 +401,7 @@ class TestableTTMServerMessageUpdateJob extends TTMServerMessageUpdateJob {
*/
class TestableTTMServer extends TTMServer implements WritableTTMServer {
private $delegate;
+
public function __construct( array $config ) {
parent::__construct( $config );
$this->delegate = TTMServerMessageUpdateJobTest::$mockups[$config['name']];
@@ -438,4 +438,8 @@ class TestableTTMServer extends TTMServer implements WritableTTMServer {
public function isFrozen() {
return $this->delegate->isFrozen();
}
+
+ public function setDoReIndex() {
+ return $this->delegate->setDoReIndex();
+ }
}