From 6c3b45d4d3e0511505e6d2827bb9e188df47fff9 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Mon, 16 Nov 2015 21:48:47 +0000 Subject: [PATCH] objectcache: Add more @covers to WANObjectCache unit tests Has only ~ 30% coverage according to PHPUnit, but mostly due to lack of @covers annotations. Change-Id: I871b45d8d8ee22c7cda644c450d78f577584e78c --- .../libs/objectcache/WANObjectCacheTest.php | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php b/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php index a1fdd91f62..6495790ec8 100644 --- a/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php +++ b/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php @@ -26,7 +26,7 @@ class WANObjectCacheTest extends MediaWikiTestCase { } /** - * @dataProvider provider_testSetAndGet + * @dataProvider provideSetAndGet * @covers WANObjectCache::set() * @covers WANObjectCache::get() * @param mixed $value @@ -46,7 +46,7 @@ class WANObjectCacheTest extends MediaWikiTestCase { } } - public static function provider_testSetAndGet() { + public static function provideSetAndGet() { return array( array( 14141, 3 ), array( 3535.666, 3 ), @@ -60,6 +60,9 @@ class WANObjectCacheTest extends MediaWikiTestCase { ); } + /** + * @covers WANObjectCache::get() + */ public function testGetNotExists() { $key = wfRandomString(); $curTTL = null; @@ -69,6 +72,9 @@ class WANObjectCacheTest extends MediaWikiTestCase { $this->assertNull( $curTTL, "Non-existing key has null current TTL" ); } + /** + * @covers WANObjectCache::set() + */ public function testSetOver() { $key = wfRandomString(); for ( $i = 0; $i < 3; ++$i ) { @@ -79,6 +85,9 @@ class WANObjectCacheTest extends MediaWikiTestCase { } } + /** + * @covers WANObjectCache::set() + */ public function testStaleSet() { $key = wfRandomString(); $value = wfRandomString(); @@ -89,6 +98,7 @@ class WANObjectCacheTest extends MediaWikiTestCase { /** * @covers WANObjectCache::getWithSetCallback() + * @covers WANObjectCache::doGetWithSetCallback() */ public function testGetWithSetCallback() { $cache = $this->cache; @@ -163,6 +173,7 @@ class WANObjectCacheTest extends MediaWikiTestCase { /** * @covers WANObjectCache::getWithSetCallback() + * @covers WANObjectCache::doGetWithSetCallback() */ public function testLockTSE() { $cache = $this->cache; @@ -188,6 +199,7 @@ class WANObjectCacheTest extends MediaWikiTestCase { /** * @covers WANObjectCache::getWithSetCallback() + * @covers WANObjectCache::doGetWithSetCallback() */ public function testLockTSESlow() { $cache = $this->cache; @@ -343,6 +355,9 @@ class WANObjectCacheTest extends MediaWikiTestCase { $this->assertEquals( $t5, $t6, 'Check key time did not change' ); } + /** + * @covers WANObjectCache::set() + */ public function testSetWithLag() { $value = 1; @@ -362,6 +377,9 @@ class WANObjectCacheTest extends MediaWikiTestCase { $this->assertEquals( false, $this->cache->get( $key ), "Lagged value not written." ); } + /** + * @covers WANObjectCache::set() + */ public function testWritePending() { $value = 1; -- 2.20.1