Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

[Cache/CouchbaseCache] Return false instead of null for compat.
  • Loading branch information...
commit c07ce5fede40159c0cb2b4c747db9f299a5bc0f0 2 parents a31435a + dee33aa
Christophe Coevoet stof authored
2  lib/Doctrine/Common/Cache/CouchbaseCache.php
View
@@ -63,7 +63,7 @@ public function getCouchbase()
*/
protected function doFetch($id)
{
- return $this->couchbase->get($id);
+ return $this->couchbase->get($id) ?: false;
}
/**
12 tests/Doctrine/Tests/Common/Cache/CacheTest.php
View
@@ -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();
Please sign in to comment.
Something went wrong with that request. Please try again.