aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/objectcache/ObjectCacheTest.php
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/includes/objectcache/ObjectCacheTest.php
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/includes/objectcache/ObjectCacheTest.php')
-rw-r--r--tests/phpunit/includes/objectcache/ObjectCacheTest.php10
1 files changed, 4 insertions, 6 deletions
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();