diff options
Diffstat (limited to 'MLEB/Translate/tests/phpunit/TTMServerTest.php')
-rw-r--r-- | MLEB/Translate/tests/phpunit/TTMServerTest.php | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/MLEB/Translate/tests/phpunit/TTMServerTest.php b/MLEB/Translate/tests/phpunit/TTMServerTest.php index 5b1526c2..ac706a24 100644 --- a/MLEB/Translate/tests/phpunit/TTMServerTest.php +++ b/MLEB/Translate/tests/phpunit/TTMServerTest.php @@ -1,17 +1,15 @@ <?php /** - * Tests for TTMServer - * * @file * @author Niklas Laxström * @copyright Copyright © 2012-2013, Niklas Laxström * @license GPL-2.0-or-later */ -class TTMServerTest extends MediaWikiTestCase { +class TTMServerTest extends MediaWikiIntegrationTestCase { protected $config; - protected function setUp() { + protected function setUp() : void { global $wgTranslateTranslationServices; $this->config = $wgTranslateTranslationServices; parent::setUp(); @@ -31,11 +29,11 @@ class TTMServerTest extends MediaWikiTestCase { 'timeout-sync' => 4, 'timeout-async' => 4, 'type' => 'ttmserver', - 'class' => 'RemoteTTMServer', + 'class' => RemoteTTMServer::class, ]; } - protected function tearDown() { + protected function tearDown() : void { global $wgTranslateTranslationServices; $wgTranslateTranslationServices = $this->config; parent::tearDown(); @@ -73,7 +71,7 @@ class TTMServerTest extends MediaWikiTestCase { 'FakeTTMServer returns no suggestions for all queries' ); - $title = new Title(); + $title = $this->createMock( Title::class ); $handle = new MessageHandle( $title ); $this->assertNull( @@ -85,17 +83,17 @@ class TTMServerTest extends MediaWikiTestCase { public function testMirrorsConfig() { global $wgTranslateTranslationServices; $wgTranslateTranslationServices['primary'] = [ - 'class' => 'ElasticSearchTTMServer', + 'class' => ElasticSearchTTMServer::class, 'mirrors' => [ 'secondary' ] ]; $wgTranslateTranslationServices['secondary'] = [ - 'class' => 'ElasticSearchTTMServer', + 'class' => ElasticSearchTTMServer::class, 'mirrors' => [ 'primary', 'unknown' ] ]; $primary = TTMServer::factory( $wgTranslateTranslationServices['primary'] ); $this->assertEquals( [ 'secondary' ], $primary->getMirrors() ); $secondary = TTMServer::factory( $wgTranslateTranslationServices['secondary'] ); - $this->setExpectedException( TTMServerException::class ); + $this->expectException( TTMServerException::class ); $secondary->getMirrors(); } } |