objectcache: Add more @covers to WANObjectCache unit tests
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 16 Nov 2015 21:48:47 +0000 (21:48 +0000)
committerKrinkle <krinklemail@gmail.com>
Mon, 16 Nov 2015 21:49:52 +0000 (21:49 +0000)
Has only ~ 30% coverage according to PHPUnit, but mostly due to
lack of @covers annotations.

Change-Id: I871b45d8d8ee22c7cda644c450d78f577584e78c

tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php

index a1fdd91..6495790 100644 (file)
@@ -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;