From: Timo Tijhof Date: Tue, 23 Aug 2016 06:20:42 +0000 (-0700) Subject: objectcache: Add missing @covers to unit tests X-Git-Tag: 1.31.0-rc.0~5942^2 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=6d43bd71866a95506e426e611e20eb440cbdde71;p=lhc%2Fweb%2Fwiklou.git objectcache: Add missing @covers to unit tests * HashBagOStuff: 100% * CachedBagOStuff: 64% * MultiWriteBagOStuff: 33% Change-Id: I50bb8f5eda7eabadb5fd4b841af42b3bbcaf9611 --- diff --git a/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php b/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php index 7fe8055444..a01cc6b7b8 100644 --- a/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php +++ b/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php @@ -5,6 +5,10 @@ */ class CachedBagOStuffTest extends PHPUnit_Framework_TestCase { + /** + * @covers CachedBagOStuff::__construct + * @covers CachedBagOStuff::doGet + */ public function testGetFromBackend() { $backend = new HashBagOStuff; $cache = new CachedBagOStuff( $backend ); @@ -16,6 +20,10 @@ 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 ); @@ -30,6 +38,10 @@ class CachedBagOStuffTest extends PHPUnit_Framework_TestCase { } } + /** + * @covers CachedBagOStuff::set + * @covers CachedBagOStuff::delete + */ public function testWriteCacheOnly() { $backend = new HashBagOStuff; $cache = new CachedBagOStuff( $backend ); @@ -50,6 +62,9 @@ class CachedBagOStuffTest extends PHPUnit_Framework_TestCase { $this->assertEquals( 'old', $cache->get( 'foo' ) ); // Reloaded from backend } + /** + * @covers CachedBagOStuff::doGet + */ public function testCacheBackendMisses() { $backend = new HashBagOStuff; $cache = new CachedBagOStuff( $backend ); diff --git a/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php b/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php index fce09ae58d..c4db0cf8bf 100644 --- a/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php +++ b/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php @@ -5,6 +5,9 @@ */ class HashBagOStuffTest extends PHPUnit_Framework_TestCase { + /** + * @covers HashBagOStuff::delete + */ public function testDelete() { $cache = new HashBagOStuff(); for ( $i = 0; $i < 10; $i++ ) { @@ -15,6 +18,9 @@ class HashBagOStuffTest extends PHPUnit_Framework_TestCase { } } + /** + * @covers HashBagOStuff::clear + */ public function testClear() { $cache = new HashBagOStuff(); for ( $i = 0; $i < 10; $i++ ) { @@ -27,6 +33,10 @@ class HashBagOStuffTest extends PHPUnit_Framework_TestCase { } } + /** + * @covers HashBagOStuff::doGet + * @covers HashBagOStuff::expire + */ public function testExpire() { $cache = new HashBagOStuff(); $cacheInternal = TestingAccessWrapper::newFromObject( $cache ); @@ -45,6 +55,9 @@ class HashBagOStuffTest extends PHPUnit_Framework_TestCase { /** * Ensure maxKeys eviction prefers keeping new keys. + * + * @covers HashBagOStuff::__construct + * @covers HashBagOStuff::set */ public function testEvictionAdd() { $cache = new HashBagOStuff( [ 'maxKeys' => 10 ] ); @@ -62,6 +75,9 @@ class HashBagOStuffTest extends PHPUnit_Framework_TestCase { /** * Ensure maxKeys eviction prefers recently set keys * even if the keys pre-exist. + * + * @covers HashBagOStuff::__construct + * @covers HashBagOStuff::set */ public function testEvictionSet() { $cache = new HashBagOStuff( [ 'maxKeys' => 3 ] ); @@ -85,6 +101,10 @@ class HashBagOStuffTest extends PHPUnit_Framework_TestCase { /** * Ensure maxKeys eviction prefers recently retrieved keys (LRU). + * + * @covers HashBagOStuff::__construct + * @covers HashBagOStuff::doGet + * @covers HashBagOStuff::hasKey */ public function testEvictionGet() { $cache = new HashBagOStuff( [ 'maxKeys' => 3 ] ); diff --git a/tests/phpunit/includes/libs/objectcache/MultiWriteBagOStuffTest.php b/tests/phpunit/includes/libs/objectcache/MultiWriteBagOStuffTest.php index 6df74d6c39..38d63e341c 100644 --- a/tests/phpunit/includes/libs/objectcache/MultiWriteBagOStuffTest.php +++ b/tests/phpunit/includes/libs/objectcache/MultiWriteBagOStuffTest.php @@ -23,6 +23,10 @@ class MultiWriteBagOStuffTest extends MediaWikiTestCase { ] ); } + /** + * @covers MultiWriteBagOStuff::set + * @covers MultiWriteBagOStuff::doWrite + */ public function testSetImmediate() { $key = wfRandomString(); $value = wfRandomString(); @@ -34,6 +38,9 @@ class MultiWriteBagOStuffTest extends MediaWikiTestCase { $this->assertEquals( $value, $this->cache2->get( $key ), 'Written to tier 2' ); } + /** + * @covers MultiWriteBagOStuff + */ public function testSyncMerge() { $key = wfRandomString(); $value = wfRandomString(); @@ -69,6 +76,9 @@ class MultiWriteBagOStuffTest extends MediaWikiTestCase { $dbw->commit(); } + /** + * @covers MultiWriteBagOStuff::set + */ public function testSetDelayed() { $key = wfRandomString(); $value = wfRandomString();