diff options
author | DannyS712 <dannys712.wiki@gmail.com> | 2021-05-05 00:03:26 +0000 |
---|---|---|
committer | DannyS712 <dannys712.wiki@gmail.com> | 2021-05-05 10:57:59 -0700 |
commit | 31676abea50c3fe55971b17bc98cdfc4a2f8bcf9 (patch) | |
tree | 8f2cb4de318350eebb16d8b76298057ab8392494 /tests/phpunit/includes/api/query/ApiQueryTest.php | |
parent | f413a6210bb873df54b6005d2ed7db2293e0f01a (diff) | |
download | mediawikicore-31676abea50c3fe55971b17bc98cdfc4a2f8bcf9.tar.gz mediawikicore-31676abea50c3fe55971b17bc98cdfc4a2f8bcf9.zip |
Add DummyServicesTrait::getDummyInterwikiLookup
Replacing the mock InterwikiLookup used in
MediaWikiTitleCodecTest revealed that that test was,
because of the mock not behaving correctly, testing the
wrong thing - interwiki prefixes are *not* case sensitive,
and are always converted to lowercase in the actual
ClassicInterwikiLookup. Fixed those expectations.
Change-Id: I242431e88860b7700a9f93f77a0fe195fd748800
Diffstat (limited to 'tests/phpunit/includes/api/query/ApiQueryTest.php')
-rw-r--r-- | tests/phpunit/includes/api/query/ApiQueryTest.php | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/phpunit/includes/api/query/ApiQueryTest.php b/tests/phpunit/includes/api/query/ApiQueryTest.php index f46853bb1e7a..6378d8039a79 100644 --- a/tests/phpunit/includes/api/query/ApiQueryTest.php +++ b/tests/phpunit/includes/api/query/ApiQueryTest.php @@ -1,6 +1,6 @@ <?php -use MediaWiki\Interwiki\ClassicInterwikiLookup; +use MediaWiki\Tests\Unit\DummyServicesTrait; /** * @group API @@ -9,18 +9,17 @@ use MediaWiki\Interwiki\ClassicInterwikiLookup; * @covers ApiQuery */ class ApiQueryTest extends ApiTestCase { + use DummyServicesTrait; + protected function setUp() : void { parent::setUp(); // Setup apiquerytestiw: as interwiki prefix - $this->setMwGlobals( [ - 'wgInterwikiCache' => ClassicInterwikiLookup::buildCdbHash( [ - [ - 'iw_prefix' => 'apiquerytestiw', - 'iw_url' => 'wikipedia', - ], - ] ), + // DummyServicesTrait::getDummyInterwikiLookup + $interwikiLookup = $this->getDummyInterwikiLookup( [ + [ 'iw_prefix' => 'apiquerytestiw', 'iw_url' => 'wikipedia' ], ] ); + $this->setService( 'InterwikiLookup', $interwikiLookup ); } public function testTitlesGetNormalized() { |