aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit
diff options
context:
space:
mode:
authorTimo Tijhof <krinkle@fastmail.com>2023-02-21 16:44:38 +0000
committerKrinkle <krinkle@fastmail.com>2023-02-21 21:27:40 +0000
commitbf342382522dfce37dd86ab99a0b8591dbc523cc (patch)
treee66c611fda9f24608fd778c489ad3bcfa2c42708 /tests/phpunit
parentde4c75274264febe5cc5fcfed21dba606941cb71 (diff)
downloadmediawikicore-bf342382522dfce37dd86ab99a0b8591dbc523cc.tar.gz
mediawikicore-bf342382522dfce37dd86ab99a0b8591dbc523cc.zip
objectcache,rdbms: Widen needlessly narrow @covers test annotations
We'd lose more useful coverage and spend more effort keeping these accurate through refactors etc than is worth the theoretically "bad" accidental coverage. Plus, even then we still very often forget to update these and waste time digging into seemingly uncovered code and either write duplicate test or discover they are already covered. Especially for private methods this can be a flawed endavour as we tend to trust tests when changing those and thus feel we shouldn't update tests, except it's riddled with private method mentions for coverage purposes (not in terms of actual called code). I think the best practice is to write good narrow unit tests, not to write bad tests and then hide their coverage. Generally that's what we do. Maybe these are useful when invoking a huge legacy class, but generally we don't need these I think, at least in the libs our team maintains. Change-Id: I4c7d826c7ec654b9efa20778c46c498784661f1c
Diffstat (limited to 'tests/phpunit')
-rw-r--r--tests/phpunit/includes/OutputPageTest.php2
-rw-r--r--tests/phpunit/includes/libs/objectcache/BagOStuffTestBase.php70
-rw-r--r--tests/phpunit/includes/libs/objectcache/MultiWriteBagOStuffTest.php40
-rw-r--r--tests/phpunit/includes/objectcache/ObjectCacheTest.php10
-rw-r--r--tests/phpunit/unit/includes/libs/objectcache/CachedBagOStuffTest.php30
-rw-r--r--tests/phpunit/unit/includes/libs/objectcache/HashBagOStuffTest.php37
-rw-r--r--tests/phpunit/unit/includes/libs/objectcache/ReplicatedBagOStuffTest.php25
-rw-r--r--tests/phpunit/unit/includes/libs/rdbms/database/DBConnRefTest.php13
-rw-r--r--tests/phpunit/unit/includes/libs/rdbms/database/DatabaseDomainTest.php9
-rw-r--r--tests/phpunit/unit/includes/libs/rdbms/database/DatabaseSQLTest.php140
-rw-r--r--tests/phpunit/unit/includes/libs/rdbms/database/DatabaseTest.php91
-rw-r--r--tests/phpunit/unit/includes/libs/rdbms/platform/MySQLPlatformTest.php7
-rw-r--r--tests/phpunit/unit/includes/libs/rdbms/platform/SQLPlatformTest.php9
-rw-r--r--tests/phpunit/unit/includes/objectcache/MemcachedBagOStuffTest.php6
-rw-r--r--tests/phpunit/unit/includes/objectcache/RedisBagOStuffTest.php3
-rw-r--r--tests/phpunit/unit/includes/objectcache/SqlBagOStuffTest.php5
16 files changed, 35 insertions, 462 deletions
diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php
index c1700e1080e9..7c651c0b678f 100644
--- a/tests/phpunit/includes/OutputPageTest.php
+++ b/tests/phpunit/includes/OutputPageTest.php
@@ -3029,7 +3029,7 @@ class OutputPageTest extends MediaWikiIntegrationTestCase {
/**
* @dataProvider providePreloadLinkHeaders
- * @covers \MediaWiki\ResourceLoader\SkinModule::getPreloadLinks
+ * @covers \MediaWiki\ResourceLoader\SkinModule
*/
public function testPreloadLinkHeaders( $config, $result ) {
$ctx = $this->createMock( RL\Context::class );
diff --git a/tests/phpunit/includes/libs/objectcache/BagOStuffTestBase.php b/tests/phpunit/includes/libs/objectcache/BagOStuffTestBase.php
index c2335e30e274..59cfe850029a 100644
--- a/tests/phpunit/includes/libs/objectcache/BagOStuffTestBase.php
+++ b/tests/phpunit/includes/libs/objectcache/BagOStuffTestBase.php
@@ -8,6 +8,7 @@ use Wikimedia\TestingAccessWrapper;
* @author Matthias Mullie <mmullie@wikimedia.org>
* @group BagOStuff
* @covers BagOStuff
+ * @covers MediumSpecificBagOStuff
*/
abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
/** @var BagOStuff */
@@ -49,10 +50,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->markTestSkipped( "No $className is configured" );
}
- /**
- * @covers MediumSpecificBagOStuff::makeGlobalKey
- * @covers MediumSpecificBagOStuff::makeKeyInternal
- */
public function testMakeKey() {
$cache = new HashBagOStuff( [ 'keyspace' => 'local_prefix' ] );
@@ -90,9 +87,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers MediumSpecificBagOStuff::isKeyGlobal
- */
public function testKeyIsGlobal() {
$cache = new HashBagOStuff();
@@ -103,10 +97,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertTrue( $cache->isKeyGlobal( $globalKey ) );
}
- /**
- * @covers MediumSpecificBagOStuff::merge
- * @covers MediumSpecificBagOStuff::mergeViaCas
- */
public function testMerge() {
$key = $this->cache->makeKey( $this->testKey() );
@@ -147,9 +137,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
}
}
- /**
- * @covers MediumSpecificBagOStuff::changeTTL
- */
public function testChangeTTLRenew() {
$key = $this->cache->makeKey( $this->testKey() );
$value = 'meow';
@@ -165,9 +152,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertFalse( $this->cache->changeTTL( $key, 15 ) );
}
- /**
- * @covers MediumSpecificBagOStuff::changeTTL
- */
public function testChangeTTLExpireRel() {
$key = $this->cache->makeKey( $this->testKey() );
$value = 'meow';
@@ -179,9 +163,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertFalse( $this->cache->changeTTL( $key, -3600 ) );
}
- /**
- * @covers MediumSpecificBagOStuff::changeTTL
- */
public function testChangeTTLExpireAbs() {
$key = $this->cache->makeKey( $this->testKey() );
$value = 'meow';
@@ -195,9 +176,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertFalse( $this->cache->changeTTL( $key, (int)$now - 3600 ) );
}
- /**
- * @covers MediumSpecificBagOStuff::changeTTLMulti
- */
public function testChangeTTLMulti() {
$key1 = $this->cache->makeKey( 'test-key1' );
$key2 = $this->cache->makeKey( 'test-key2' );
@@ -244,9 +222,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->cache->deleteMulti( [ $key1, $key2, $key3, $key4 ] );
}
- /**
- * @covers MediumSpecificBagOStuff::add
- */
public function testAdd() {
$key = $this->cache->makeKey( $this->testKey() );
$this->assertFalse( $this->cache->get( $key ) );
@@ -266,9 +241,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertSame( 'test', $this->cache->get( $key ) );
}
- /**
- * @covers MediumSpecificBagOStuff::get
- */
public function testGet() {
$value = [ 'this' => 'is', 'a' => 'test' ];
@@ -277,11 +249,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertSame( $this->cache->get( $key ), $value );
}
- /**
- * @covers MediumSpecificBagOStuff::get
- * @covers MediumSpecificBagOStuff::set
- * @covers MediumSpecificBagOStuff::getWithSetCallback
- */
public function testGetWithSetCallback() {
$now = self::TEST_TIME;
$cache = new HashBagOStuff( [] );
@@ -308,9 +275,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertFalse( $cache->get( $key ), "Value expired" );
}
- /**
- * @covers MediumSpecificBagOStuff::incr
- */
public function testIncr() {
$key = $this->cache->makeKey( $this->testKey() );
$this->cache->add( $key, 0, 5 );
@@ -320,9 +284,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertEquals( $expectedValue, $actualValue, 'Value should be 1 after incrementing' );
}
- /**
- * @covers MediumSpecificBagOStuff::incrWithInit
- */
public function testIncrWithInit() {
$key = $this->cache->makeKey( $this->testKey() );
@@ -366,9 +327,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertSame( 4, $val );
}
- /**
- * @covers MediumSpecificBagOStuff::getMulti
- */
public function testGetMulti() {
$value1 = [ 'this' => 'is', 'a' => 'test' ];
$value2 = [ 'this' => 'is', 'another' => 'test' ];
@@ -406,10 +364,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->cache->delete( $key4 );
}
- /**
- * @covers MediumSpecificBagOStuff::setMulti
- * @covers MediumSpecificBagOStuff::deleteMulti
- */
public function testSetDeleteMulti() {
$map = [
$this->cache->makeKey( 'test-1' ) => 'Siberian',
@@ -445,12 +399,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertTrue( $this->cache->delete( $key, BagOStuff::WRITE_BACKGROUND ) );
}
- /**
- * @covers MediumSpecificBagOStuff::get
- * @covers MediumSpecificBagOStuff::getMulti
- * @covers MediumSpecificBagOStuff::merge
- * @covers MediumSpecificBagOStuff::delete
- */
public function testSetSegmentable() {
$key = $this->cache->makeKey( $this->testKey() );
$tiny = 418;
@@ -516,9 +464,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->cache->set( $key, 'background', BagOStuff::WRITE_BACKGROUND ) );
}
- /**
- * @covers MediumSpecificBagOStuff::getScopedLock
- */
public function testGetScopedLock() {
$key = $this->cache->makeKey( $this->testKey() );
$value1 = $this->cache->getScopedLock( $key, 0 );
@@ -540,10 +485,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertInstanceOf( ScopedCallback::class, $value2, 'Second reentrant call returned lock' );
}
- /**
- * @covers MediumSpecificBagOStuff::__construct
- * @covers MediumSpecificBagOStuff::trackDuplicateKeys
- */
public function testReportDupes() {
$logger = $this->createMock( Psr\Log\NullLogger::class );
$logger->expects( $this->once() )
@@ -565,10 +506,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
DeferredUpdates::doUpdates();
}
- /**
- * @covers MediumSpecificBagOStuff::lock()
- * @covers MediumSpecificBagOStuff::unlock()
- */
public function testLocking() {
$key = $this->cache->makeKey( $this->testKey() );
$this->assertTrue( $this->cache->lock( $key ) );
@@ -582,11 +519,6 @@ abstract class BagOStuffTestBase extends MediaWikiIntegrationTestCase {
$this->assertTrue( $this->cache->unlock( $key ) );
}
- /**
- * @covers MediumSpecificBagOStuff::watchErrors()
- * @covers MediumSpecificBagOStuff::getLastError()
- * @covers MediumSpecificBagOStuff::setLastError()
- */
public function testErrorHandling() {
$key = $this->cache->makeKey( $this->testKey() );
$wrapper = TestingAccessWrapper::newFromObject( $this->cache );
diff --git a/tests/phpunit/includes/libs/objectcache/MultiWriteBagOStuffTest.php b/tests/phpunit/includes/libs/objectcache/MultiWriteBagOStuffTest.php
index e7c9b6ebfdcc..4f3f0f74876a 100644
--- a/tests/phpunit/includes/libs/objectcache/MultiWriteBagOStuffTest.php
+++ b/tests/phpunit/includes/libs/objectcache/MultiWriteBagOStuffTest.php
@@ -4,6 +4,8 @@ use Wikimedia\LightweightObjectStore\StorageAwareness;
use Wikimedia\TestingAccessWrapper;
/**
+ * @covers MultiWriteBagOStuff
+ * @group BagOStuff
* @group Database
*/
class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
@@ -26,9 +28,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
] );
}
- /**
- * @covers MultiWriteBagOStuff::set
- */
public function testSet() {
$key = 'key';
$value = 'value';
@@ -40,9 +39,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
$this->assertSame( $value, $this->cache2->get( $key ), 'Written to tier 2' );
}
- /**
- * @covers MultiWriteBagOStuff::add
- */
public function testAdd() {
$key = 'key';
$value = 'value';
@@ -55,9 +51,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
$this->assertSame( $value, $this->cache2->get( $key ), 'Written to tier 2' );
}
- /**
- * @covers MultiWriteBagOStuff
- */
public function testSyncMergeAsync() {
$key = 'keyA';
$value = 'value';
@@ -81,9 +74,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
$this->assertEquals( $value, $this->cache2->get( $key ), 'Written to tier 2' );
}
- /**
- * @covers MultiWriteBagOStuff
- */
public function testSyncMergeSync() {
// Like setUp() but without 'async'
$cache1 = new HashBagOStuff();
@@ -110,9 +100,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
$dbw->commit();
}
- /**
- * @covers MultiWriteBagOStuff::set
- */
public function testSetDelayed() {
$key = 'key';
$value = (object)[ 'v' => 'saved value' ];
@@ -137,9 +124,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
$this->assertEquals( $expectValue, $this->cache2->get( $key ), 'Written to tier 2' );
}
- /**
- * @covers MultiWriteBagOStuff::makeKey
- */
public function testMakeKey() {
$cache1 = $this->getMockBuilder( HashBagOStuff::class )
->onlyMethods( [ 'makeKey' ] )->getMock();
@@ -157,9 +141,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
$this->assertSame( 'generic:a:b', $cache->makeKey( 'a', 'b' ) );
}
- /**
- * @covers MultiWriteBagOStuff::makeGlobalKey
- */
public function testMakeGlobalKey() {
$cache1 = $this->getMockBuilder( HashBagOStuff::class )
->onlyMethods( [ 'makeGlobalKey' ] )->getMock();
@@ -174,9 +155,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
$this->assertSame( 'global:a:b', $cache->makeGlobalKey( 'a', 'b' ) );
}
- /**
- * @covers MultiWriteBagOStuff::add
- */
public function testDuplicateStoreAdd() {
$bag = new HashBagOStuff();
$cache = new MultiWriteBagOStuff( [
@@ -186,9 +164,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
$this->assertTrue( $cache->add( 'key', 1, 30 ) );
}
- /**
- * @covers MultiWriteBagOStuff::incr
- */
public function testIncr() {
$key = $this->cache->makeKey( 'key' );
@@ -201,9 +176,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
$this->assertSame( 8, $value, 'Value after incrementing' );
}
- /**
- * @covers MultiWriteBagOStuff::decr
- */
public function testDecr() {
$key = $this->cache->makeKey( 'key' );
@@ -216,9 +188,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
$this->assertSame( 9, $value, 'Value after decrementing' );
}
- /**
- * @covers MultiWriteBagOStuff::incrWithInit
- */
public function testIncrWithInit() {
$key = $this->cache->makeKey( 'key' );
$val = $this->cache->incrWithInit( $key, 0, 1, 3 );
@@ -232,11 +201,6 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
$this->assertSame( 5, $val, "Correct init value" );
}
- /**
- * @covers MultiWriteBagOStuff::watchErrors()
- * @covers MultiWriteBagOStuff::getLastError()
- * @covers MultiWriteBagOStuff::setLastError()
- */
public function testErrorHandling() {
$t1Cache = $this->createPartialMock( HashBagOStuff::class, [ 'set' ] );
$t1CacheWrapper = TestingAccessWrapper::newFromObject( $t1Cache );
diff --git a/tests/phpunit/includes/objectcache/ObjectCacheTest.php b/tests/phpunit/includes/objectcache/ObjectCacheTest.php
index bb8d0ed51948..a6477b0ba843 100644
--- a/tests/phpunit/includes/objectcache/ObjectCacheTest.php
+++ b/tests/phpunit/includes/objectcache/ObjectCacheTest.php
@@ -2,6 +2,10 @@
use MediaWiki\MainConfigNames;
+/**
+ * @covers ObjectCache
+ * @group BagOStuff
+ */
class ObjectCacheTest extends MediaWikiIntegrationTestCase {
protected function setUp(): void {
@@ -29,7 +33,6 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
$this->overrideConfigValue( MainConfigNames::ObjectCaches, $arr + $defaults );
}
- /** @covers ObjectCache::newAnything */
public function testNewAnythingNothing() {
$this->assertInstanceOf(
SqlBagOStuff::class,
@@ -38,7 +41,6 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
);
}
- /** @covers ObjectCache::newAnything */
public function testNewAnythingHash() {
$this->setMainCache( CACHE_HASH );
@@ -49,7 +51,6 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
);
}
- /** @covers ObjectCache::newAnything */
public function testNewAnythingAccel() {
$this->setMainCache( CACHE_ACCEL );
@@ -60,7 +61,6 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
);
}
- /** @covers ObjectCache::newAnything */
public function testNewAnythingNoAccel() {
$this->setMainCache( CACHE_ACCEL );
@@ -76,7 +76,6 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
);
}
- /** @covers ObjectCache::newAnything */
public function testNewAnythingNoAccelNoDb() {
$this->setMainCache( CACHE_ACCEL );
@@ -94,7 +93,6 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
);
}
- /** @covers ObjectCache::newAnything */
public function testNewAnythingNothingNoDb() {
$this->getServiceContainer()->disableStorage();
diff --git a/tests/phpunit/unit/includes/libs/objectcache/CachedBagOStuffTest.php b/tests/phpunit/unit/includes/libs/objectcache/CachedBagOStuffTest.php
index fde32c155e0a..a2ee49a68330 100644
--- a/tests/phpunit/unit/includes/libs/objectcache/CachedBagOStuffTest.php
+++ b/tests/phpunit/unit/includes/libs/objectcache/CachedBagOStuffTest.php
@@ -4,16 +4,13 @@ use Wikimedia\LightweightObjectStore\StorageAwareness;
use Wikimedia\TestingAccessWrapper;
/**
+ * @covers CachedBagOStuff
* @group BagOStuff
*/
class CachedBagOStuffTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
- /**
- * @covers CachedBagOStuff::__construct
- * @covers CachedBagOStuff::get
- */
public function testGetFromBackend() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
@@ -25,10 +22,6 @@ class CachedBagOStuffTest extends PHPUnit\Framework\TestCase {
$this->assertEquals( 'bar', $cache->get( 'foo' ), 'cached' );
}
- /**
- * @covers CachedBagOStuff::set
- * @covers CachedBagOStuff::delete
- */
public function testSetAndDelete() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
@@ -44,10 +37,6 @@ class CachedBagOStuffTest extends PHPUnit\Framework\TestCase {
}
}
- /**
- * @covers CachedBagOStuff::set
- * @covers CachedBagOStuff::delete
- */
public function testWriteCacheOnly() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
@@ -68,9 +57,6 @@ class CachedBagOStuffTest extends PHPUnit\Framework\TestCase {
$this->assertEquals( 'old', $cache->get( 'foo' ) ); // Reloaded from backend
}
- /**
- * @covers CachedBagOStuff::get
- */
public function testCacheBackendMisses() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
@@ -89,9 +75,6 @@ class CachedBagOStuffTest extends PHPUnit\Framework\TestCase {
$this->assertTrue( $cache->get( 'bar' ) );
}
- /**
- * @covers CachedBagOStuff::deleteObjectsExpiringBefore
- */
public function testExpire() {
$backend = $this->getMockBuilder( HashBagOStuff::class )
->onlyMethods( [ 'deleteObjectsExpiringBefore' ] )
@@ -104,9 +87,6 @@ class CachedBagOStuffTest extends PHPUnit\Framework\TestCase {
$cache->deleteObjectsExpiringBefore( '20110401000000' );
}
- /**
- * @covers CachedBagOStuff::makeKey
- */
public function testMakeKey() {
$backend = $this->getMockBuilder( HashBagOStuff::class )
->setConstructorArgs( [ [ 'keyspace' => 'magic' ] ] )
@@ -125,9 +105,6 @@ class CachedBagOStuffTest extends PHPUnit\Framework\TestCase {
);
}
- /**
- * @covers CachedBagOStuff::makeGlobalKey
- */
public function testMakeGlobalKey() {
$backend = $this->getMockBuilder( HashBagOStuff::class )
->setConstructorArgs( [ [ 'keyspace' => 'magic' ] ] )
@@ -142,11 +119,6 @@ class CachedBagOStuffTest extends PHPUnit\Framework\TestCase {
$this->assertSame( 'global:special:logic', $cache->makeGlobalKey( 'special', 'logic' ) );
}
- /**
- * @covers CachedBagOStuff::watchErrors()
- * @covers CachedBagOStuff::getLastError()
- * @covers CachedBagOStuff::setLastError()
- */
public function testErrorHandling() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
diff --git a/tests/phpunit/unit/includes/libs/objectcache/HashBagOStuffTest.php b/tests/phpunit/unit/includes/libs/objectcache/HashBagOStuffTest.php
index 4ed51cffd6be..61fa4f22ca8c 100644
--- a/tests/phpunit/unit/includes/libs/objectcache/HashBagOStuffTest.php
+++ b/tests/phpunit/unit/includes/libs/objectcache/HashBagOStuffTest.php
@@ -4,14 +4,14 @@ use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
use Wikimedia\TestingAccessWrapper;
/**
+ * @covers HashBagOStuff
+ * @covers MediumSpecificBagOStuff
+ * @covers BagOStuff
* @group BagOStuff
*/
class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
- /**
- * @covers HashBagOStuff::__construct
- */
public function testConstruct() {
$this->assertInstanceOf(
HashBagOStuff::class,
@@ -19,9 +19,6 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
);
}
- /**
- * @covers HashBagOStuff::__construct
- */
public function testQoS() {
$bag = new HashBagOStuff();
@@ -31,33 +28,21 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
);
}
- /**
- * @covers HashBagOStuff::__construct
- */
public function testConstructBadZero() {
$this->expectException( InvalidArgumentException::class );
$cache = new HashBagOStuff( [ 'maxKeys' => 0 ] );
}
- /**
- * @covers HashBagOStuff::__construct
- */
public function testConstructBadNeg() {
$this->expectException( InvalidArgumentException::class );
$cache = new HashBagOStuff( [ 'maxKeys' => -1 ] );
}
- /**
- * @covers HashBagOStuff::__construct
- */
public function testConstructBadType() {
$this->expectException( InvalidArgumentException::class );
$cache = new HashBagOStuff( [ 'maxKeys' => 'x' ] );
}
- /**
- * @covers HashBagOStuff::delete
- */
public function testDelete() {
$cache = new HashBagOStuff();
for ( $i = 0; $i < 10; $i++ ) {
@@ -68,9 +53,6 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
}
}
- /**
- * @covers HashBagOStuff::clear
- */
public function testClear() {
$cache = new HashBagOStuff();
for ( $i = 0; $i < 10; $i++ ) {
@@ -83,10 +65,6 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
}
}
- /**
- * @covers HashBagOStuff::doGet
- * @covers HashBagOStuff::expire
- */
public function testExpire() {
$cache = new HashBagOStuff();
$cacheInternal = TestingAccessWrapper::newFromObject( $cache );
@@ -115,8 +93,6 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
/**
* Ensure maxKeys eviction prefers keeping new keys.
- *
- * @covers HashBagOStuff::set
*/
public function testEvictionAdd() {
$cache = new HashBagOStuff( [ 'maxKeys' => 10 ] );
@@ -134,8 +110,6 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
/**
* Ensure maxKeys eviction prefers recently set keys
* even if the keys pre-exist.
- *
- * @covers HashBagOStuff::set
*/
public function testEvictionSet() {
$cache = new HashBagOStuff( [ 'maxKeys' => 3 ] );
@@ -159,9 +133,6 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
/**
* Ensure maxKeys eviction prefers recently retrieved keys (LRU).
- *
- * @covers HashBagOStuff::doGet
- * @covers HashBagOStuff::hasKey
*/
public function testEvictionGet() {
$cache = new HashBagOStuff( [ 'maxKeys' => 3 ] );
@@ -185,8 +156,6 @@ class HashBagOStuffTest extends PHPUnit\Framework\TestCase {
/**
* Ensure updateOpStats doesn't get confused.
- *
- * @covers MediumSpecificBagOStuff::updateOpStats
*/
public function testUpdateOpStats() {
$counts = [];
diff --git a/tests/phpunit/unit/includes/libs/objectcache/ReplicatedBagOStuffTest.php b/tests/phpunit/unit/includes/libs/objectcache/ReplicatedBagOStuffTest.php
index 6056551b0959..43a04ac747c3 100644
--- a/tests/phpunit/unit/includes/libs/objectcache/ReplicatedBagOStuffTest.php
+++ b/tests/phpunit/unit/includes/libs/objectcache/ReplicatedBagOStuffTest.php
@@ -3,6 +3,9 @@
use Wikimedia\LightweightObjectStore\StorageAwareness;
use Wikimedia\TestingAccessWrapper;
+/**
+ * @covers ReplicatedBagOStuff
+ */
class ReplicatedBagOStuffTest extends \MediaWikiUnitTestCase {
/** @var HashBagOStuff */
private $writeCache;
@@ -23,9 +26,6 @@ class ReplicatedBagOStuffTest extends \MediaWikiUnitTestCase {
] );
}
- /**
- * @covers ReplicatedBagOStuff::set
- */
public function testSet() {
$key = $this->cache->makeKey( 'a', 'key' );
$value = 'a value';
@@ -36,9 +36,6 @@ class ReplicatedBagOStuffTest extends \MediaWikiUnitTestCase {
$this->assertFalse( $this->readCache->get( $key ), 'Async replication' );
}
- /**
- * @covers ReplicatedBagOStuff::get
- */
public function testGet() {
$key = $this->cache->makeKey( 'a', 'key' );
@@ -50,9 +47,6 @@ class ReplicatedBagOStuffTest extends \MediaWikiUnitTestCase {
$this->assertSame( $read, $this->cache->get( $key ), 'Async replication' );
}
- /**
- * @covers ReplicatedBagOStuff::get
- */
public function testGetAbsent() {
$key = $this->cache->makeKey( 'a', 'key' );
$value = 'a value';
@@ -61,10 +55,6 @@ class ReplicatedBagOStuffTest extends \MediaWikiUnitTestCase {
$this->assertFalse( $this->cache->get( $key ), 'Async replication' );
}
- /**
- * @covers ReplicatedBagOStuff::setMulti
- * @covers ReplicatedBagOStuff::getMulti
- */
public function testGetSetMulti() {
$keyA = $this->cache->makeKey( 'key', 'a' );
$keyB = $this->cache->makeKey( 'key', 'b' );
@@ -83,10 +73,6 @@ class ReplicatedBagOStuffTest extends \MediaWikiUnitTestCase {
);
}
- /**
- * @covers ReplicatedBagOStuff::get
- * @covers ReplicatedBagOStuff::set
- */
public function testGetSetRaw() {
$key = 'a:key';
$value = 'a value';
@@ -98,11 +84,6 @@ class ReplicatedBagOStuffTest extends \MediaWikiUnitTestCase {
$this->assertFalse( $this->readCache->get( $key ) );
}
- /**
- * @covers ReplicatedBagOStuff::watchErrors()
- * @covers ReplicatedBagOStuff::getLastError()
- * @covers ReplicatedBagOStuff::setLastError()
- */
public function testErrorHandling() {
$wCache = $this->createPartialMock( HashBagOStuff::class, [ 'set' ] );
$wCacheWrapper = TestingAccessWrapper::newFromObject( $wCache );
diff --git a/tests/phpunit/unit/includes/libs/rdbms/database/DBConnRefTest.php b/tests/phpunit/unit/includes/libs/rdbms/database/DBConnRefTest.php
index c5c00cf35c28..530282978da6 100644
--- a/tests/phpunit/unit/includes/libs/rdbms/database/DBConnRefTest.php
+++ b/tests/phpunit/unit/includes/libs/rdbms/database/DBConnRefTest.php
@@ -145,9 +145,6 @@ class DBConnRefTest extends PHPUnit\Framework\TestCase {
new DBConnRef( $lb, 17, DB_REPLICA ); // bad constructor argument
}
- /**
- * @covers Wikimedia\Rdbms\DBConnRef::getDomainId
- */
public function testGetDomainID() {
$lb = $this->createMock( ILoadBalancer::class );
@@ -160,9 +157,6 @@ class DBConnRefTest extends PHPUnit\Framework\TestCase {
$this->assertSame( 'dummy', $ref->getDomainID() );
}
- /**
- * @covers Wikimedia\Rdbms\DBConnRef::select
- */
public function testSelect() {
// select should get passed through normally
$ref = $this->getDBConnRef();
@@ -178,9 +172,6 @@ class DBConnRefTest extends PHPUnit\Framework\TestCase {
$this->assertIsString( $ref->__toString() );
}
- /**
- * @covers Wikimedia\Rdbms\DBConnRef::close
- */
public function testClose() {
$lb = $this->getLoadBalancerMock();
$ref = new DBConnRef( $lb, [ DB_REPLICA, [], 'dummy', 0 ], DB_PRIMARY );
@@ -188,9 +179,6 @@ class DBConnRefTest extends PHPUnit\Framework\TestCase {
$ref->close();
}
- /**
- * @covers Wikimedia\Rdbms\DBConnRef::getReferenceRole
- */
public function testGetReferenceRole() {
$lb = $this->getLoadBalancerMock();
$ref = new DBConnRef( $lb, [ DB_REPLICA, [], 'dummy', 0 ], DB_REPLICA );
@@ -207,7 +195,6 @@ class DBConnRefTest extends PHPUnit\Framework\TestCase {
}
/**
- * @covers Wikimedia\Rdbms\DBConnRef::getReferenceRole
* @dataProvider provideRoleExceptions
*/
public function testRoleExceptions( $method, $args ) {
diff --git a/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseDomainTest.php b/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseDomainTest.php
index ffa6e9a8731b..add1ab6f3e8c 100644
--- a/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseDomainTest.php
+++ b/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseDomainTest.php
@@ -103,7 +103,6 @@ class DatabaseDomainTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideEquals
- * @covers Wikimedia\Rdbms\DatabaseDomain::equals
*/
public function testEquals( $id, $db, $schema, $prefix ) {
$fromId = DatabaseDomain::newFromId( $id );
@@ -118,9 +117,6 @@ class DatabaseDomainTest extends PHPUnit\Framework\TestCase {
$this->assertTrue( $fromId->equals( $constructed ), 'compare newId to constructed' );
}
- /**
- * @covers Wikimedia\Rdbms\DatabaseDomain::newUnspecified
- */
public function testNewUnspecified() {
$domain = DatabaseDomain::newUnspecified();
$this->assertInstanceOf( DatabaseDomain::class, $domain );
@@ -157,7 +153,6 @@ class DatabaseDomainTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideIsCompatible
- * @covers Wikimedia\Rdbms\DatabaseDomain::isCompatible
*/
public function testIsCompatible( $id, $db, $schema, $prefix, $transitive ) {
$compareIdObj = DatabaseDomain::newFromId( $id );
@@ -185,7 +180,6 @@ class DatabaseDomainTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideIsCompatible2
- * @covers Wikimedia\Rdbms\DatabaseDomain::isCompatible
*/
public function testIsCompatible2( $id, $db, $schema, $prefix ) {
$compareIdObj = DatabaseDomain::newFromId( $id );
@@ -207,9 +201,6 @@ class DatabaseDomainTest extends PHPUnit\Framework\TestCase {
DatabaseDomain::newFromId( '-schema-prefix' );
}
- /**
- * @covers Wikimedia\Rdbms\DatabaseDomain::isUnspecified
- */
public function testIsUnspecified() {
$domain = new DatabaseDomain( null, null, '' );
$this->assertTrue( $domain->isUnspecified() );
diff --git a/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseSQLTest.php b/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseSQLTest.php
index 501ef3debf1d..28ae296a94f9 100644
--- a/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseSQLTest.php
+++ b/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseSQLTest.php
@@ -12,6 +12,10 @@ use Wikimedia\TestingAccessWrapper;
/**
* Test the parts of the Database abstract class that deal
* with creating SQL text.
+ *
+ * @covers Wikimedia\Rdbms\Database
+ * @covers Wikimedia\Rdbms\Subquery
+ * @covers Wikimedia\Rdbms\Platform\SQLPlatform
*/
class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
@@ -44,7 +48,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideQueryMulti
- * @covers Wikimedia\Rdbms\Database::queryMulti
*/
public function testQueryMulti( array $sqls, string $summarySql, array $resTriples ) {
foreach ( $resTriples as [ $res, $errno, $error ] ) {
@@ -76,16 +79,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideSelect
- * @covers Wikimedia\Rdbms\Database::select
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::selectSQLText
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::tableNamesWithIndexClauseOrJOIN
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::useIndexClause
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::ignoreIndexClause
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::makeSelectOptions
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::makeOrderBy
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::makeGroupByWithHaving
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::selectFieldsOrOptionsAggregate
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::selectOptionsIncludeLocking
*/
public function testSelect( $sql, $sqlText ) {
$this->database->select(
@@ -301,7 +294,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideLockForUpdate
- * @covers Wikimedia\Rdbms\Database::lockForUpdate
*/
public function testLockForUpdate( $sql, $sqlText ) {
$this->database->startAtomic( __METHOD__ );
@@ -352,7 +344,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
}
/**
- * @covers Wikimedia\Rdbms\Subquery
* @dataProvider provideSelectRowCount
* @param array $sql
* @param string $sqlText
@@ -448,10 +439,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideUpdate
- * @covers Wikimedia\Rdbms\Database::update
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::makeUpdateOptions
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::makeUpdateOptionsArray
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::assertConditionIsNotEmpty
*/
public function testUpdate( $sql, $sqlText ) {
$this->hideDeprecated( 'Wikimedia\Rdbms\Platform\SQLPlatform::updateSqlText' );
@@ -545,10 +532,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideUpdateEmptyCondition
- * @covers Wikimedia\Rdbms\Database::update
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::makeUpdateOptions
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::makeUpdateOptionsArray
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::assertConditionIsNotEmpty
*/
public function testUpdateEmptyCondition( $sql ) {
$this->expectDeprecation();
@@ -589,8 +572,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideDelete
- * @covers Wikimedia\Rdbms\Database::delete
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::assertConditionIsNotEmpty
*/
public function testDelete( $sql, $sqlText ) {
$this->database->delete(
@@ -631,8 +612,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideDeleteEmptyCondition
- * @covers Wikimedia\Rdbms\Database::delete
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::assertConditionIsNotEmpty
*/
public function testDeleteEmptyCondition( $sql ) {
try {
@@ -672,7 +651,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideUpsert
- * @covers Wikimedia\Rdbms\Database::upsert
*/
public function testUpsert( $sql, $sqlText ) {
$this->database->setNextQueryAffectedRowCounts( [ 0 ] );
@@ -775,7 +753,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideDeleteJoin
- * @covers Wikimedia\Rdbms\Database::deleteJoin
*/
public function testDeleteJoin( $sql, $sqlText ) {
$this->database->deleteJoin(
@@ -822,7 +799,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideInsert
- * @covers Wikimedia\Rdbms\Database::insert
*/
public function testInsert( $sql, $sqlText ) {
$this->database->insert(
@@ -875,8 +851,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideInsertSelect
- * @covers Wikimedia\Rdbms\Database::insertSelect
- * @covers Wikimedia\Rdbms\Database::doInsertSelectNative
*/
public function testInsertSelect( $sql, $sqlTextNative, $sqlSelect, $sqlInsert ) {
$this->database->insertSelect(
@@ -986,10 +960,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
];
}
- /**
- * @covers Wikimedia\Rdbms\Database::insertSelect
- * @covers Wikimedia\Rdbms\Database::doInsertSelectNative
- */
public function testInsertSelectBatching() {
$dbWeb = new DatabaseTestHelper( __CLASS__, [ 'cliMode' => false ] );
$rows = [];
@@ -1016,7 +986,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideReplace
- * @covers Wikimedia\Rdbms\Database::replace
*/
public function testReplace( $sql, $sqlText ) {
$this->database->replace(
@@ -1104,7 +1073,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideConditional
- * @covers Wikimedia\Rdbms\Database::conditional
*/
public function testConditional( $sql, $sqlText ) {
$this->assertEquals( $this->database->conditional(
@@ -1145,7 +1113,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideBuildConcat
- * @covers Wikimedia\Rdbms\Database::buildConcat
*/
public function testBuildConcat( $stringList, $sqlText ) {
$this->assertEquals( trim( $this->database->buildConcat(
@@ -1168,7 +1135,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideUnionQueries
- * @covers Wikimedia\Rdbms\Database::unionQueries
*/
public function testUnionQueries( $sql, $sqlText ) {
$this->assertEquals( trim( $this->database->unionQueries(
@@ -1203,38 +1169,24 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
];
}
- /**
- * @covers Wikimedia\Rdbms\Database::commit
- * @covers Wikimedia\Rdbms\Database::doCommit
- */
public function testTransactionCommit() {
$this->database->begin( __METHOD__ );
$this->database->commit( __METHOD__ );
$this->assertLastSql( 'BEGIN; COMMIT' );
}
- /**
- * @covers Wikimedia\Rdbms\Database::rollback
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::rollbackSqlText
- */
public function testTransactionRollback() {
$this->database->begin( __METHOD__ );
$this->database->rollback( __METHOD__ );
$this->assertLastSql( 'BEGIN; ROLLBACK' );
}
- /**
- * @covers Wikimedia\Rdbms\Database::dropTable
- */
public function testDropTable() {
$this->database->setExistingTables( [ 'table' ] );
$this->database->dropTable( 'table', __METHOD__ );
$this->assertLastSql( 'DROP TABLE table CASCADE' );
}
- /**
- * @covers Wikimedia\Rdbms\Database::dropTable
- */
public function testDropNonExistingTable() {
$this->assertFalse(
$this->database->dropTable( 'non_existing', __METHOD__ )
@@ -1243,7 +1195,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideMakeList
- * @covers Wikimedia\Rdbms\Database::makeList
*/
public function testMakeList( $list, $mode, $sqlText ) {
$this->assertEquals( trim( $this->database->makeList(
@@ -1323,7 +1274,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideFactorConds
- * @covers Wikimedia\Rdbms\Database::factorConds
*/
public function testFactorConds( $input, $expected ) {
if ( $expected === 'invalid' ) {
@@ -1395,9 +1345,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
];
}
- /**
- * @covers Wikimedia\Rdbms\Database::getTempTableWrites
- */
public function testSessionTempTables() {
$temp1 = $this->database->tableName( 'tmp_table_1' );
$temp2 = $this->database->tableName( 'tmp_table_2' );
@@ -1444,7 +1391,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
}
/**
- * @covers Wikimedia\Rdbms\Database::buildSubstring
* @dataProvider provideBuildSubstring
*/
public function testBuildSubstring( $input, $start, $length, $expected ) {
@@ -1462,8 +1408,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
}
/**
- * @covers Wikimedia\Rdbms\Database::buildSubstring
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::assertBuildSubstringParams
* @dataProvider provideBuildSubstring_invalidParams
*/
public function testBuildSubstring_invalidParams( $start, $length ) {
@@ -1471,23 +1415,11 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
$this->database->buildSubstring( 'foo', $start, $length );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::buildIntegerCast
- */
public function testBuildIntegerCast() {
$output = $this->database->buildIntegerCast( 'fieldName' );
$this->assertSame( 'CAST( fieldName AS INTEGER )', $output );
}
- /**
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::savepointSqlText
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::releaseSavepointSqlText
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::rollbackToSavepointSqlText
- * @covers \Wikimedia\Rdbms\Database::startAtomic
- * @covers \Wikimedia\Rdbms\Database::endAtomic
- * @covers \Wikimedia\Rdbms\Database::cancelAtomic
- * @covers \Wikimedia\Rdbms\Database::doAtomicSection
- */
public function testAtomicSections() {
$this->database->startAtomic( __METHOD__ );
$this->database->endAtomic( __METHOD__ );
@@ -1706,15 +1638,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
] ) );
}
- /**
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::savepointSqlText
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::releaseSavepointSqlText
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::rollbackToSavepointSqlText
- * @covers \Wikimedia\Rdbms\Database::startAtomic
- * @covers \Wikimedia\Rdbms\Database::endAtomic
- * @covers \Wikimedia\Rdbms\Database::cancelAtomic
- * @covers \Wikimedia\Rdbms\Database::doAtomicSection
- */
public function testAtomicSectionsRecovery() {
$this->database->begin( __METHOD__ );
try {
@@ -1760,15 +1683,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
$this->assertLastSql( 'BEGIN; ROLLBACK' );
}
- /**
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::savepointSqlText
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::releaseSavepointSqlText
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::rollbackToSavepointSqlText
- * @covers \Wikimedia\Rdbms\Database::startAtomic
- * @covers \Wikimedia\Rdbms\Database::endAtomic
- * @covers \Wikimedia\Rdbms\Database::cancelAtomic
- * @covers \Wikimedia\Rdbms\Database::doAtomicSection
- */
public function testAtomicSectionsCallbackCancellation() {
$fname = __METHOD__;
$callback1Called = null;
@@ -1942,15 +1856,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
$this->assertSame( 1, $callback4Called );
}
- /**
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::savepointSqlText
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::releaseSavepointSqlText
- * @covers \Wikimedia\Rdbms\Platform\SQLPlatform::rollbackToSavepointSqlText
- * @covers \Wikimedia\Rdbms\Database::startAtomic
- * @covers \Wikimedia\Rdbms\Database::endAtomic
- * @covers \Wikimedia\Rdbms\Database::cancelAtomic
- * @covers \Wikimedia\Rdbms\Database::doAtomicSection
- */
public function testAtomicSectionsTrxRound() {
$this->database->setFlag( IDatabase::DBO_TRX );
$this->database->startAtomic( __METHOD__, IDatabase::ATOMIC_CANCELABLE );
@@ -1969,8 +1874,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideAtomicSectionMethodsForErrors
- * @covers \Wikimedia\Rdbms\Database::endAtomic
- * @covers \Wikimedia\Rdbms\Database::cancelAtomic
*/
public function testNoAtomicSection( $method ) {
try {
@@ -1986,8 +1889,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideAtomicSectionMethodsForErrors
- * @covers \Wikimedia\Rdbms\Database::endAtomic
- * @covers \Wikimedia\Rdbms\Database::cancelAtomic
*/
public function testInvalidAtomicSectionEnded( $method ) {
$this->database->startAtomic( __METHOD__ . 'X' );
@@ -2003,9 +1904,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
}
}
- /**
- * @covers \Wikimedia\Rdbms\Database::cancelAtomic
- */
public function testUncancellableAtomicSection() {
$this->database->startAtomic( __METHOD__ );
try {
@@ -2020,9 +1918,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
}
}
- /**
- * @covers \Wikimedia\Rdbms\Database::onAtomicSectionCancel
- */
public function testNoAtomicSectionForCallback() {
try {
$this->database->onAtomicSectionCancel( static function () {
@@ -2036,9 +1931,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
}
}
- /**
- * @covers \Wikimedia\Rdbms\Database::assertQueryIsCurrentlyAllowed
- */
public function testTransactionErrorState1() {
$wrapper = TestingAccessWrapper::newFromObject( $this->database );
@@ -2048,9 +1940,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
$this->database->delete( 'x', [ 'field' => 3 ], __METHOD__ );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::query
- */
public function testTransactionErrorState2() {
$wrapper = TestingAccessWrapper::newFromObject( $this->database );
@@ -2093,9 +1982,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
$this->assertSame( 0, $this->database->trxLevel() );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::query
- */
public function testImplicitTransactionRollback() {
$doError = function () {
$this->database->forceNextResult( false, 666, 'Evilness' );
@@ -2147,9 +2033,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
$this->assertLastSql( 'BEGIN; DELETE FROM x WHERE field = 1; DELETE FROM error WHERE 1; ROLLBACK' );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::query
- */
public function testTransactionStatementRollbackIgnoring() {
$wrapper = TestingAccessWrapper::newFromObject( $this->database );
$warning = [];
@@ -2215,9 +2098,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
$this->assertLastSql( 'BEGIN; DELETE FROM error WHERE 1; DELETE FROM x WHERE field = 1; COMMIT' );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::close
- */
public function testPrematureClose1() {
$fname = __METHOD__;
$this->database->begin( __METHOD__ );
@@ -2235,9 +2115,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
$this->assertSame( 0, $this->database->trxLevel() );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::close
- */
public function testPrematureClose2() {
$fname = __METHOD__;
$this->database->startAtomic( __METHOD__ );
@@ -2255,9 +2132,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
$this->assertSame( 0, $this->database->trxLevel() );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::close
- */
public function testPrematureClose3() {
$this->database->setFlag( IDatabase::DBO_TRX );
$this->database->delete( 'x', [ 'field' => 3 ], __METHOD__ );
@@ -2269,9 +2143,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
$this->assertSame( 0, $this->database->trxLevel() );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::close
- */
public function testPrematureClose4() {
$this->database->setFlag( IDatabase::DBO_TRX );
$this->database->query( 'SELECT 1', __METHOD__ );
@@ -2284,9 +2155,6 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
$this->assertSame( 0, $this->database->trxLevel() );
}
- /**
- * @covers Wikimedia\Rdbms\Database::selectFieldValues()
- */
public function testSelectFieldValues() {
$this->database->forceNextResult( [
(object)[ 'value' => 'row1' ],
diff --git a/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseTest.php b/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseTest.php
index ea362a621bf6..a710a74138be 100644
--- a/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseTest.php
+++ b/tests/phpunit/unit/includes/libs/rdbms/database/DatabaseTest.php
@@ -20,6 +20,12 @@ use Wikimedia\Rdbms\TransactionManager;
use Wikimedia\RequestTimeout\CriticalSectionScope;
use Wikimedia\TestingAccessWrapper;
+/**
+ * @dataProvider provideAddQuotes
+ * @covers Wikimedia\Rdbms\Database
+ * @covers Wikimedia\Rdbms\Database\DatabaseFlags
+ * @covers Wikimedia\Rdbms\Platform\SQLPlatform
+ */
class DatabaseTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
@@ -43,7 +49,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideAddQuotes
- * @covers Wikimedia\Rdbms\Database::addQuotes
*/
public function testAddQuotes( $input, $expected ) {
$this->assertEquals( $expected, $this->db->addQuotes( $input ) );
@@ -102,7 +107,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideTableName
- * @covers Wikimedia\Rdbms\Database::tableName
*/
public function testTableName( $expected, $table, $format, array $alias = null ) {
if ( $alias ) {
@@ -152,7 +156,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideTableNamesWithIndexClauseOrJOIN
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::tableNamesWithIndexClauseOrJOIN
*/
public function testTableNamesWithIndexClauseOrJOIN( $tables, $join_conds, $expect ) {
$clause = TestingAccessWrapper::newFromObject( ( new SQLPlatformTestHelper( new AddQuoterMock() ) ) )
@@ -160,10 +163,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->assertSame( $expect, $clause );
}
- /**
- * @covers Wikimedia\Rdbms\Database::onTransactionCommitOrIdle
- * @covers Wikimedia\Rdbms\Database::runOnTransactionIdleCallbacks
- */
public function testTransactionIdle() {
$db = $this->db;
@@ -201,10 +200,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->assertFalse( $db->getFlag( DBO_TRX ), 'DBO_TRX restored to default' );
}
- /**
- * @covers Wikimedia\Rdbms\Database::onTransactionCommitOrIdle
- * @covers Wikimedia\Rdbms\Database::runOnTransactionIdleCallbacks
- */
public function testTransactionIdle_TRX() {
$db = $this->getMockDB( [ 'isOpen', 'ping', 'getDBname' ] );
$db->method( 'isOpen' )->willReturn( true );
@@ -265,10 +260,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$lbFactory->flushPrimarySessions( __METHOD__ );
}
- /**
- * @covers Wikimedia\Rdbms\Database::onTransactionPreCommitOrIdle
- * @covers Wikimedia\Rdbms\Database::runOnTransactionPreCommitCallbacks
- */
public function testTransactionPreCommitOrIdle() {
$db = $this->getMockDB( [ 'isOpen' ] );
$db->method( 'isOpen' )->willReturn( true );
@@ -298,10 +289,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->assertTrue( $called, 'Called when transaction is committed' );
}
- /**
- * @covers Wikimedia\Rdbms\Database::onTransactionPreCommitOrIdle
- * @covers Wikimedia\Rdbms\Database::runOnTransactionPreCommitCallbacks
- */
public function testTransactionPreCommitOrIdle_TRX() {
$db = $this->getMockDB( [ 'isOpen', 'ping', 'getDBname' ] );
$db->method( 'isOpen' )->willReturn( true );
@@ -349,10 +336,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$lbFactory->flushPrimarySessions( __METHOD__ );
}
- /**
- * @covers Wikimedia\Rdbms\Database::onTransactionResolution
- * @covers Wikimedia\Rdbms\Database::runOnTransactionIdleCallbacks
- */
public function testTransactionResolution() {
$db = $this->db;
@@ -379,9 +362,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->assertTrue( $called, 'Callback reached' );
}
- /**
- * @covers Wikimedia\Rdbms\Database::setTransactionListener
- */
public function testTransactionListener() {
$db = $this->db;
@@ -472,9 +452,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
return $db;
}
- /**
- * @covers Wikimedia\Rdbms\Database::flushSnapshot
- */
public function testFlushSnapshot() {
$db = $this->getMockDB( [ 'isOpen' ] );
$db->method( 'isOpen' )->willReturn( true );
@@ -491,12 +468,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->assertFalse( (bool)$db->trxLevel(), "Transaction cleared." );
}
- /**
- * @covers Wikimedia\Rdbms\Database::getScopedLockAndFlush
- * @covers Wikimedia\Rdbms\Database::lock
- * @covers Wikimedia\Rdbms\Database::unlock
- * @covers Wikimedia\Rdbms\Database::lockIsFree
- */
public function testGetScopedLock() {
$db = $this->getMockDB( [ 'isOpen', 'getDBname' ] );
$db->method( 'isOpen' )->willReturn( true );
@@ -570,11 +541,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$db->rollback( __METHOD__ );
}
- /**
- * @covers Wikimedia\Rdbms\Database::getFlag
- * @covers Wikimedia\Rdbms\Database::setFlag
- * @covers Wikimedia\Rdbms\Database::restoreFlags
- */
public function testFlagSetting() {
$db = $this->db;
$origTrx = $db->getFlag( DBO_TRX );
@@ -619,7 +585,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
}
/**
- * @covers Wikimedia\Rdbms\Database\DatabaseFlags::setFlag
* @dataProvider provideImmutableDBOFlags
* @param int $flag
*/
@@ -631,7 +596,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
}
/**
- * @covers Wikimedia\Rdbms\Database\DatabaseFlags::clearFlag
* @dataProvider provideImmutableDBOFlags
* @param int $flag
*/
@@ -642,10 +606,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$flagsHolder->clearFlag( $flag );
}
- /**
- * @covers Wikimedia\Rdbms\Database::tablePrefix
- * @covers Wikimedia\Rdbms\Database::dbSchema
- */
public function testSchemaAndPrefixMutators() {
$ud = DatabaseDomain::newUnspecified();
@@ -691,10 +651,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->assertEquals( $oldSchema, $this->db->dbSchema(), 'Schema restored' );
}
- /**
- * @covers Wikimedia\Rdbms\Database::tablePrefix
- * @covers Wikimedia\Rdbms\Database::dbSchema
- */
public function testSchemaWithNoDB() {
$ud = DatabaseDomain::newUnspecified();
@@ -705,9 +661,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->db->dbSchema( 'xxx' );
}
- /**
- * @covers Wikimedia\Rdbms\Database::selectDomain
- */
public function testSelectDomain() {
$oldDomain = $this->db->getDomainID();
$oldDatabase = $this->db->getDBname();
@@ -737,10 +690,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->assertSame( $oldDomain, $this->db->getDomainID() );
}
- /**
- * @covers Wikimedia\Rdbms\Database::getLBInfo
- * @covers Wikimedia\Rdbms\Database::setLBInfo
- */
public function testGetSetLBInfo() {
$db = $this->getMockDB();
@@ -765,10 +714,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->assertEquals( [ 'King' => 'James' ], $db->getLBInfo() );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::executeQuery()
- * @covers \Wikimedia\Rdbms\Database::assertIsWritablePrimary()
- */
public function testShouldRejectPersistentWriteQueryOnReplicaDatabaseConnection() {
$this->expectException( DBReadOnlyRoleError::class );
$this->expectDeprecationMessage( 'Server is configured as a read-only replica database.' );
@@ -781,10 +726,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$dbr->query( "INSERT INTO test_table (a_column) VALUES ('foo');", __METHOD__ );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::executeQuery()
- * @covers \Wikimedia\Rdbms\Database::assertIsWritablePrimary()
- */
public function testShouldAcceptTemporaryTableOperationsOnReplicaDatabaseConnection() {
$dbr = new DatabaseTestHelper(
__CLASS__ . '::' . $this->getName(),
@@ -805,10 +746,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->assertInstanceOf( IResultWrapper::class, $resModify );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::executeQuery()
- * @covers \Wikimedia\Rdbms\Database::assertIsWritablePrimary()
- */
public function testShouldRejectPseudoPermanentTemporaryTableOperationsOnReplicaDatabaseConnection() {
$this->expectException( DBReadOnlyRoleError::class );
$this->expectDeprecationMessage( 'Server is configured as a read-only replica database.' );
@@ -825,10 +762,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
);
}
- /**
- * @covers \Wikimedia\Rdbms\Database::executeQuery()
- * @covers \Wikimedia\Rdbms\Database::assertIsWritablePrimary()
- */
public function testShouldAcceptWriteQueryOnPrimaryDatabaseConnection() {
$dbr = new DatabaseTestHelper(
__CLASS__ . '::' . $this->getName(),
@@ -840,10 +773,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$this->assertInstanceOf( IResultWrapper::class, $res );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::executeQuery()
- * @covers \Wikimedia\Rdbms\Database::assertIsWritablePrimary()
- */
public function testShouldRejectWriteQueryOnPrimaryDatabaseConnectionWhenReplicaQueryRoleFlagIsSet() {
$this->expectException( DBReadOnlyRoleError::class );
$this->expectDeprecationMessage( 'Cannot write; target role is DB_REPLICA' );
@@ -860,10 +789,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
);
}
- /**
- * @covers \Wikimedia\Rdbms\Database::commenceCriticalSection()
- * @covers \Wikimedia\Rdbms\Database::completeCriticalSection()
- */
public function testCriticalSectionErrorSelect() {
$this->expectException( DBTransactionStateError::class );
@@ -877,10 +802,6 @@ class DatabaseTest extends PHPUnit\Framework\TestCase {
$db->query( "SELECT 1", __METHOD__ );
}
- /**
- * @covers \Wikimedia\Rdbms\Database::commenceCriticalSection()
- * @covers \Wikimedia\Rdbms\Database::completeCriticalSection()
- */
public function testCriticalSectionErrorRollback() {
$db = TestingAccessWrapper::newFromObject( $this->db );
try {
diff --git a/tests/phpunit/unit/includes/libs/rdbms/platform/MySQLPlatformTest.php b/tests/phpunit/unit/includes/libs/rdbms/platform/MySQLPlatformTest.php
index 84063f2ec526..0db9ccf138aa 100644
--- a/tests/phpunit/unit/includes/libs/rdbms/platform/MySQLPlatformTest.php
+++ b/tests/phpunit/unit/includes/libs/rdbms/platform/MySQLPlatformTest.php
@@ -21,6 +21,9 @@
use MediaWiki\Tests\Unit\Libs\Rdbms\AddQuoterMock;
use Wikimedia\Rdbms\Platform\MySQLPlatform;
+/**
+ * @covers \Wikimedia\Rdbms\Platform\MySQLPlatform
+ */
class MySQLPlatformTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
@@ -35,16 +38,12 @@ class MySQLPlatformTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideDiapers
- * @covers \Wikimedia\Rdbms\Platform\MySQLPlatform::addIdentifierQuotes
*/
public function testAddIdentifierQuotes( $expected, $in ) {
$quoted = $this->platform->addIdentifierQuotes( $in );
$this->assertEquals( $expected, $quoted );
}
- /**
- * @covers \Wikimedia\Rdbms\Platform\MySQLPlatform::addIdentifierQuotes
- */
public function testAddIdentifierQuotesNull() {
// Ignore PHP 8.1+ warning about null to str_replace()
$quoted = @$this->platform->addIdentifierQuotes( null );
diff --git a/tests/phpunit/unit/includes/libs/rdbms/platform/SQLPlatformTest.php b/tests/phpunit/unit/includes/libs/rdbms/platform/SQLPlatformTest.php
index a86255dac20a..c0cfc057148d 100644
--- a/tests/phpunit/unit/includes/libs/rdbms/platform/SQLPlatformTest.php
+++ b/tests/phpunit/unit/includes/libs/rdbms/platform/SQLPlatformTest.php
@@ -6,6 +6,7 @@ use Wikimedia\Rdbms\LikeMatch;
/**
* @covers Wikimedia\Rdbms\Platform\SQLPlatform
+ * @covers Wikimedia\Rdbms\Database
*/
class SQLPlatformTest extends PHPUnit\Framework\TestCase {
@@ -21,7 +22,6 @@ class SQLPlatformTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideGreatest
- * @covers Wikimedia\Rdbms\Database::buildGreatest
*/
public function testBuildGreatest( $fields, $values, $sqlText ) {
$this->assertEquals(
@@ -57,7 +57,6 @@ class SQLPlatformTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideLeast
- * @covers Wikimedia\Rdbms\Database::buildLeast
*/
public function testBuildLeast( $fields, $values, $sqlText ) {
$this->assertEquals(
@@ -93,7 +92,6 @@ class SQLPlatformTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideBuildComparison
- * @covers Wikimedia\Rdbms\Database::buildComparison
*/
public function testBuildComparison( string $op, array $conds, string $sqlText ) {
$this->assertEquals(
@@ -156,8 +154,6 @@ class SQLPlatformTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideBuildLike
- * @covers Wikimedia\Rdbms\Database::buildLike
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::escapeLikeInternal
*/
public function testBuildLike( $array, $sqlText ) {
$this->assertEquals( trim( $this->platform->buildLike(
@@ -200,7 +196,6 @@ class SQLPlatformTest extends PHPUnit\Framework\TestCase {
/**
* @dataProvider provideUnionConditionPermutations
- * @covers Wikimedia\Rdbms\Database::unionConditionPermutations
*/
public function testUnionConditionPermutations( $params, $expect ) {
if ( isset( $params['unionSupportsOrderAndLimit'] ) ) {
@@ -367,7 +362,6 @@ class SQLPlatformTest extends PHPUnit\Framework\TestCase {
}
/**
- * @covers Wikimedia\Rdbms\Platform\SQLPlatform::isWriteQuery
* @param string $query
* @param bool $res
* @dataProvider provideIsWriteQuery
@@ -377,7 +371,6 @@ class SQLPlatformTest extends PHPUnit\Framework\TestCase {
}
/**
- * Provider for testIsWriteQuery
* @return array
*/
public function provideIsWriteQuery(): array {
diff --git a/tests/phpunit/unit/includes/objectcache/MemcachedBagOStuffTest.php b/tests/phpunit/unit/includes/objectcache/MemcachedBagOStuffTest.php
index 231815dcaca5..de8026ff32f3 100644
--- a/tests/phpunit/unit/includes/objectcache/MemcachedBagOStuffTest.php
+++ b/tests/phpunit/unit/includes/objectcache/MemcachedBagOStuffTest.php
@@ -1,5 +1,6 @@
<?php
/**
+ * @covers MemcachedBagOStuff
* @group BagOStuff
*/
class MemcachedBagOStuffTest extends \MediaWikiUnitTestCase {
@@ -11,9 +12,6 @@ class MemcachedBagOStuffTest extends \MediaWikiUnitTestCase {
$this->cache = new MemcachedPhpBagOStuff( [ 'keyspace' => 'test', 'servers' => [] ] );
}
- /**
- * @covers MemcachedBagOStuff::makeKey
- */
public function testKeyNormalization() {
$this->assertEquals(
'test:vanilla',
@@ -70,7 +68,6 @@ class MemcachedBagOStuffTest extends \MediaWikiUnitTestCase {
/**
* @dataProvider validKeyProvider
- * @covers MemcachedBagOStuff::validateKeyEncoding
*/
public function testValidateKeyEncoding( $key ) {
$this->assertSame( $key, $this->cache->validateKeyEncoding( $key ) );
@@ -87,7 +84,6 @@ class MemcachedBagOStuffTest extends \MediaWikiUnitTestCase {
/**
* @dataProvider invalidKeyProvider
- * @covers MemcachedBagOStuff::validateKeyEncoding
*/
public function testValidateKeyEncodingThrowsException( $key ) {
$this->expectException( Exception::class );
diff --git a/tests/phpunit/unit/includes/objectcache/RedisBagOStuffTest.php b/tests/phpunit/unit/includes/objectcache/RedisBagOStuffTest.php
index 8ea971cdb77c..b3dc776464da 100644
--- a/tests/phpunit/unit/includes/objectcache/RedisBagOStuffTest.php
+++ b/tests/phpunit/unit/includes/objectcache/RedisBagOStuffTest.php
@@ -3,6 +3,7 @@
use Wikimedia\TestingAccessWrapper;
/**
+ * @covers RedisBagOStuff
* @group BagOStuff
*/
class RedisBagOStuffTest extends MediaWikiUnitTestCase {
@@ -18,7 +19,6 @@ class RedisBagOStuffTest extends MediaWikiUnitTestCase {
}
/**
- * @covers RedisBagOStuff::unserialize
* @dataProvider unserializeProvider
*/
public function testUnserialize( $expected, $input, $message ) {
@@ -57,7 +57,6 @@ class RedisBagOStuffTest extends MediaWikiUnitTestCase {
}
/**
- * @covers RedisBagOStuff::serialize
* @dataProvider serializeProvider
*/
public function testSerialize( $expected, $input, $message ) {
diff --git a/tests/phpunit/unit/includes/objectcache/SqlBagOStuffTest.php b/tests/phpunit/unit/includes/objectcache/SqlBagOStuffTest.php
index 60512093c2ff..e21c234c09a8 100644
--- a/tests/phpunit/unit/includes/objectcache/SqlBagOStuffTest.php
+++ b/tests/phpunit/unit/includes/objectcache/SqlBagOStuffTest.php
@@ -1,5 +1,9 @@
<?php
+/**
+ * @covers SqlBagOStuff
+ * @group BagOStuff
+ */
class SqlBagOStuffTest extends MediaWikiUnitTestCase {
public static function provideMakeKey() {
yield [ 'local', 'first', [ 'second', 'third' ],
@@ -20,7 +24,6 @@ class SqlBagOStuffTest extends MediaWikiUnitTestCase {
* @param string $class
* @param array $components
* @param string $expected
- * @covers SqlBagOStuff::makeKeyInternal
* @dataProvider SqlBagOStuffTest::provideMakeKey
*/
public function testMakeKey(