From: Timo Tijhof Date: Sat, 1 Apr 2017 01:03:17 +0000 (-0700) Subject: objectcache: Complete code coverage for HashBagOStuff X-Git-Tag: 1.31.0-rc.0~3638^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=751f2b9d251d2c65a7a1f2c20af894790551d7f1;p=lhc%2Fweb%2Fwiklou.git objectcache: Complete code coverage for HashBagOStuff Change-Id: I06cb9778df8239706bf82c0c39cccb419eade4b2 --- diff --git a/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php b/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php index c4db0cf8bf..f44baeb831 100644 --- a/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php +++ b/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php @@ -5,6 +5,40 @@ */ class HashBagOStuffTest extends PHPUnit_Framework_TestCase { + /** + * @covers HashBagOStuff::__construct + */ + public function testConstruct() { + $this->assertInstanceOf( + HashBagOStuff::class, + new HashBagOStuff() + ); + } + + /** + * @covers HashBagOStuff::__construct + * @expectedException InvalidArgumentException + */ + public function testConstructBadZero() { + $cache = new HashBagOStuff( [ 'maxKeys' => 0 ] ); + } + + /** + * @covers HashBagOStuff::__construct + * @expectedException InvalidArgumentException + */ + public function testConstructBadNeg() { + $cache = new HashBagOStuff( [ 'maxKeys' => -1 ] ); + } + + /** + * @covers HashBagOStuff::__construct + * @expectedException InvalidArgumentException + */ + public function testConstructBadType() { + $cache = new HashBagOStuff( [ 'maxKeys' => 'x' ] ); + } + /** * @covers HashBagOStuff::delete */ @@ -56,7 +90,6 @@ class HashBagOStuffTest extends PHPUnit_Framework_TestCase { /** * Ensure maxKeys eviction prefers keeping new keys. * - * @covers HashBagOStuff::__construct * @covers HashBagOStuff::set */ public function testEvictionAdd() { @@ -76,7 +109,6 @@ 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() { @@ -102,7 +134,6 @@ class HashBagOStuffTest extends PHPUnit_Framework_TestCase { /** * Ensure maxKeys eviction prefers recently retrieved keys (LRU). * - * @covers HashBagOStuff::__construct * @covers HashBagOStuff::doGet * @covers HashBagOStuff::hasKey */