|
|
@@ -107,6 +107,8 @@ class Zend_Cache_TwoLevelsBackendTest extends Zend_Cache_CommonExtendedBackendTe
|
|
|
$fastBackend->expects($this->at(1))
|
|
|
->method('getFillingPercentage')
|
|
|
->will($this->returnValue(90));
|
|
|
+
|
|
|
+
|
|
|
$slowBackendOptions = array(
|
|
|
'cache_dir' => $this->_cache_dir
|
|
|
);
|
|
|
@@ -118,12 +120,42 @@ class Zend_Cache_TwoLevelsBackendTest extends Zend_Cache_CommonExtendedBackendTe
|
|
|
));
|
|
|
|
|
|
$id = 'test'.uniqid();
|
|
|
- $cache->save(10, $id); //fast usage at 0%
|
|
|
-
|
|
|
- $cache->save(100, $id); //fast usage at 90%
|
|
|
+ $this->assertTrue($cache->save(10, $id)); //fast usage at 0%
|
|
|
+
|
|
|
+ $this->assertTrue($cache->save(100, $id)); //fast usage at 90%
|
|
|
$this->assertEquals(100, $cache->load($id));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @group ZF-9855
|
|
|
+ */
|
|
|
+ public function testSaveReturnsTrueIfFastIsFullOnFirstSave()
|
|
|
+ {
|
|
|
+ $slowBackend = 'File';
|
|
|
+ $fastBackend = $this->getMock('Zend_Cache_Backend_Apc', array('getFillingPercentage'));
|
|
|
+ $fastBackend->expects($this->any())
|
|
|
+ ->method('getFillingPercentage')
|
|
|
+ ->will($this->returnValue(90));
|
|
|
|
|
|
+ $slowBackendOptions = array(
|
|
|
+ 'cache_dir' => $this->_cache_dir
|
|
|
+ );
|
|
|
+ $cache = new Zend_Cache_Backend_TwoLevels(array(
|
|
|
+ 'fast_backend' => $fastBackend,
|
|
|
+ 'slow_backend' => $slowBackend,
|
|
|
+ 'slow_backend_options' => $slowBackendOptions,
|
|
|
+ 'stats_update_factor' => 1
|
|
|
+ ));
|
|
|
+
|
|
|
+ $id = 'test'.uniqid();
|
|
|
+
|
|
|
+ $this->assertTrue($cache->save(90, $id)); //fast usage at 90%, failing for
|
|
|
+ $this->assertEquals(90, $cache->load($id));
|
|
|
+
|
|
|
+ $this->assertTrue($cache->save(100, $id)); //fast usage at 90%
|
|
|
+ $this->assertEquals(100, $cache->load($id));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|