* HashBagOStuff: 100%
* CachedBagOStuff: 64%
* MultiWriteBagOStuff: 33%
Change-Id: I50bb8f5eda7eabadb5fd4b841af42b3bbcaf9611
*/
class CachedBagOStuffTest extends PHPUnit_Framework_TestCase {
*/
class CachedBagOStuffTest extends PHPUnit_Framework_TestCase {
+ /**
+ * @covers CachedBagOStuff::__construct
+ * @covers CachedBagOStuff::doGet
+ */
public function testGetFromBackend() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
public function testGetFromBackend() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
$this->assertEquals( 'bar', $cache->get( 'foo' ), 'cached' );
}
$this->assertEquals( 'bar', $cache->get( 'foo' ), 'cached' );
}
+ /**
+ * @covers CachedBagOStuff::set
+ * @covers CachedBagOStuff::delete
+ */
public function testSetAndDelete() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
public function testSetAndDelete() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
+ /**
+ * @covers CachedBagOStuff::set
+ * @covers CachedBagOStuff::delete
+ */
public function testWriteCacheOnly() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
public function testWriteCacheOnly() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
$this->assertEquals( 'old', $cache->get( 'foo' ) ); // Reloaded from backend
}
$this->assertEquals( 'old', $cache->get( 'foo' ) ); // Reloaded from backend
}
+ /**
+ * @covers CachedBagOStuff::doGet
+ */
public function testCacheBackendMisses() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
public function testCacheBackendMisses() {
$backend = new HashBagOStuff;
$cache = new CachedBagOStuff( $backend );
*/
class HashBagOStuffTest extends PHPUnit_Framework_TestCase {
*/
class HashBagOStuffTest extends PHPUnit_Framework_TestCase {
+ /**
+ * @covers HashBagOStuff::delete
+ */
public function testDelete() {
$cache = new HashBagOStuff();
for ( $i = 0; $i < 10; $i++ ) {
public function testDelete() {
$cache = new HashBagOStuff();
for ( $i = 0; $i < 10; $i++ ) {
+ /**
+ * @covers HashBagOStuff::clear
+ */
public function testClear() {
$cache = new HashBagOStuff();
for ( $i = 0; $i < 10; $i++ ) {
public function testClear() {
$cache = new HashBagOStuff();
for ( $i = 0; $i < 10; $i++ ) {
+ /**
+ * @covers HashBagOStuff::doGet
+ * @covers HashBagOStuff::expire
+ */
public function testExpire() {
$cache = new HashBagOStuff();
$cacheInternal = TestingAccessWrapper::newFromObject( $cache );
public function testExpire() {
$cache = new HashBagOStuff();
$cacheInternal = TestingAccessWrapper::newFromObject( $cache );
/**
* Ensure maxKeys eviction prefers keeping new keys.
/**
* Ensure maxKeys eviction prefers keeping new keys.
+ *
+ * @covers HashBagOStuff::__construct
+ * @covers HashBagOStuff::set
*/
public function testEvictionAdd() {
$cache = new HashBagOStuff( [ 'maxKeys' => 10 ] );
*/
public function testEvictionAdd() {
$cache = new HashBagOStuff( [ 'maxKeys' => 10 ] );
/**
* Ensure maxKeys eviction prefers recently set keys
* even if the keys pre-exist.
/**
* 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 ] );
*/
public function testEvictionSet() {
$cache = new HashBagOStuff( [ 'maxKeys' => 3 ] );
/**
* Ensure maxKeys eviction prefers recently retrieved keys (LRU).
/**
* 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 ] );
*/
public function testEvictionGet() {
$cache = new HashBagOStuff( [ 'maxKeys' => 3 ] );
+ /**
+ * @covers MultiWriteBagOStuff::set
+ * @covers MultiWriteBagOStuff::doWrite
+ */
public function testSetImmediate() {
$key = wfRandomString();
$value = wfRandomString();
public function testSetImmediate() {
$key = wfRandomString();
$value = wfRandomString();
$this->assertEquals( $value, $this->cache2->get( $key ), 'Written to tier 2' );
}
$this->assertEquals( $value, $this->cache2->get( $key ), 'Written to tier 2' );
}
+ /**
+ * @covers MultiWriteBagOStuff
+ */
public function testSyncMerge() {
$key = wfRandomString();
$value = wfRandomString();
public function testSyncMerge() {
$key = wfRandomString();
$value = wfRandomString();
+ /**
+ * @covers MultiWriteBagOStuff::set
+ */
public function testSetDelayed() {
$key = wfRandomString();
$value = wfRandomString();
public function testSetDelayed() {
$key = wfRandomString();
$value = wfRandomString();