Permalink
Browse files

[Cache] Refactoring testFalseOnFailedFetch into CacheTest

This changeset makes sure that all supported caches return
false and not null when a key is not found. This ensures
compatibility with the ORM layer.
  • Loading branch information...
1 parent fc81e68 commit dee33aa89652d5f1f5d5c613a9ef53648665ac9c @daschl daschl committed Jan 7, 2013
View
12 tests/Doctrine/Tests/Common/Cache/CacheTest.php
@@ -85,6 +85,18 @@ public function testGetStats()
}
/**
+ * Make sure that all supported caches return "false" instead of "null" to be compatible
+ * with ORM integration.
+ */
+ public function testFalseOnFailedFetch()
+ {
+ $cache = $this->_getCacheDriver();
+ $result = $cache->fetch('nonexistent_key');
+ $this->assertFalse($result);
+ $this->assertNotNull($result);
+ }
+
+ /**
* @return \Doctrine\Common\Cache\CacheProvider
*/
abstract protected function _getCacheDriver();
View
7 tests/Doctrine/Tests/Common/Cache/CouchbaseCacheTest.php
@@ -38,13 +38,6 @@ public function testLongLifetime()
$this->assertTrue($cache->contains('key'), 'Couchbase provider should support TTL > 30 days');
}
- public function testFalseOnFailedFetch() {
- $cache = $this->_getCacheDriver();
- $result = $cache->fetch('nonexistent_key');
- $this->assertFalse($result);
- $this->assertNotNull($result);
- }
-
protected function _getCacheDriver()
{
$driver = new CouchbaseCache();

0 comments on commit dee33aa

Please sign in to comment.