diff options
author | daniel <dkinzler@wikimedia.org> | 2021-06-09 23:17:21 +0200 |
---|---|---|
committer | daniel <dkinzler@wikimedia.org> | 2021-09-10 16:00:02 +0200 |
commit | 855988fd0e7813fa533e121dff39113c6908b6bc (patch) | |
tree | 8361528fad38f2d762a7465cb7bf90080c3a7632 /tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php | |
parent | 6e99ddcef6b67a4033c384f23db7c54de9df1b53 (diff) | |
download | mediawikicore-855988fd0e7813fa533e121dff39113c6908b6bc.tar.gz mediawikicore-855988fd0e7813fa533e121dff39113c6908b6bc.zip |
LinkCache: soft deprecate addGoodLinkObj()
addGoodLinkObj() has many optional arguments, but omitting them actually
means corrupting the cache.
Nearly all existing callers are in tests.
So LinkCacheTestTrait::addGoodLinkObject() was created only
for testing. It is better to have this method in the
trait, because building the row directly in each test
would make these tests brittle against schema changes.
The only usage in WMF production code was in WikiPage and has been
fixed.
Bug: T284955
Change-Id: I03a2bd9ed64fcc0281ee29a286c8db395a9e03d9
Diffstat (limited to 'tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php')
-rw-r--r-- | tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php index 3ba2152346e5..187d8d8c7a44 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php @@ -1,6 +1,5 @@ <?php -use MediaWiki\MediaWikiServices; use MediaWiki\Page\PageIdentity; use MediaWiki\Page\PageIdentityValue; use MediaWiki\Page\PageRecord; @@ -12,6 +11,7 @@ use Wikimedia\TestingAccessWrapper; * @covers ResourceLoaderWikiModule */ class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase { + use LinkCacheTestTrait; /** * @dataProvider provideConstructor @@ -438,12 +438,7 @@ class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase { } ); // Mock away Title's db queries with LinkCache - MediaWikiServices::getInstance()->getLinkCache()->addGoodLinkObj( - 1, // id - new TitleValue( NS_MEDIAWIKI, 'Redirect.js' ), - 1, // len - 1 // redirect - ); + $this->addGoodLinkObject( 1, new TitleValue( NS_MEDIAWIKI, 'Redirect.js' ), 1, 1 ); $this->assertSame( "/*\nMediaWiki:Redirect.js\n*/\ntarget;\n", |