summaryrefslogtreecommitdiff
path: root/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php')
-rw-r--r--vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php29
1 files changed, 22 insertions, 7 deletions
diff --git a/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php b/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php
index 0eceb6e572..2b66d2bea0 100644
--- a/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php
+++ b/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php
@@ -59,6 +59,26 @@ abstract class AdapterTestCase extends CachePoolTest
$this->assertFalse($isHit);
}
+ public function testRecursiveGet()
+ {
+ if (isset($this->skippedTests[__FUNCTION__])) {
+ $this->markTestSkipped($this->skippedTests[__FUNCTION__]);
+ }
+
+ $cache = $this->createCachePool(0, __FUNCTION__);
+
+ $v = $cache->get('k1', function () use (&$counter, $cache) {
+ $v = $cache->get('k2', function () use (&$counter) { return ++$counter; });
+ $v = $cache->get('k2', function () use (&$counter) { return ++$counter; });
+
+ return $v;
+ });
+
+ $this->assertSame(1, $counter);
+ $this->assertSame(1, $v);
+ $this->assertSame(1, $cache->get('k2', function () { return 2; }));
+ }
+
public function testGetMetadata()
{
if (isset($this->skippedTests[__FUNCTION__])) {
@@ -215,14 +235,9 @@ abstract class AdapterTestCase extends CachePoolTest
}
}
-class NotUnserializable implements \Serializable
+class NotUnserializable
{
- public function serialize()
- {
- return serialize(123);
- }
-
- public function unserialize($ser)
+ public function __wakeup()
{
throw new \Exception(__CLASS__);
}