Permalink
Browse files

Merge pull request #240 from daschl/couchbase-cache-orm-bugfix

[Cache/CouchbaseCache] Return false instead of null for compat.
  • Loading branch information...
2 parents a31435a + dee33aa commit c07ce5fede40159c0cb2b4c747db9f299a5bc0f0 @stof stof committed Jan 7, 2013
Showing with 13 additions and 1 deletion.
  1. +1 −1 lib/Doctrine/Common/Cache/CouchbaseCache.php
  2. +12 −0 tests/Doctrine/Tests/Common/Cache/CacheTest.php
@@ -63,7 +63,7 @@ public function getCouchbase()
*/
protected function doFetch($id)
{
- return $this->couchbase->get($id);
+ return $this->couchbase->get($id) ?: false;
}
/**
@@ -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();

0 comments on commit c07ce5f

Please sign in to comment.