summaryrefslogtreecommitdiff
path: root/vendor/symfony/cache/Tests
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-06-03 14:19:10 +0100
committerGreg Roach <fisharebest@webtrees.net>2019-06-03 14:19:10 +0100
commit69c8d4f5c90cef75da102f92e4e992d03a8f1cd8 (patch)
tree4f956848961891482b64ee2cd5c8d7290936e354 /vendor/symfony/cache/Tests
parent425f99bc29ab9e477e5407b5c86da5c85ba47461 (diff)
downloadwebtrees-69c8d4f5c90cef75da102f92e4e992d03a8f1cd8.tar.gz
webtrees-69c8d4f5c90cef75da102f92e4e992d03a8f1cd8.tar.bz2
webtrees-69c8d4f5c90cef75da102f92e4e992d03a8f1cd8.zip
:Update vendor dependencies
Diffstat (limited to 'vendor/symfony/cache/Tests')
-rw-r--r--vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php29
-rw-r--r--vendor/symfony/cache/Tests/Adapter/FilesystemTagAwareAdapterTest.php28
-rw-r--r--vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Adapter/PredisTagAwareAdapterTest.php34
-rw-r--r--vendor/symfony/cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php34
-rw-r--r--vendor/symfony/cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php34
-rw-r--r--vendor/symfony/cache/Tests/Adapter/Psr16AdapterTest.php31
-rw-r--r--vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php25
-rw-r--r--vendor/symfony/cache/Tests/Adapter/RedisTagAwareAdapterTest.php35
-rw-r--r--vendor/symfony/cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php34
-rw-r--r--vendor/symfony/cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php35
-rw-r--r--vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php6
-rw-r--r--vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php122
-rw-r--r--vendor/symfony/cache/Tests/DependencyInjection/CachePoolPassTest.php22
-rw-r--r--vendor/symfony/cache/Tests/Psr16CacheTest.php168
-rw-r--r--vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php3
-rw-r--r--vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php3
-rw-r--r--vendor/symfony/cache/Tests/Simple/ArrayCacheTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Simple/CacheTestCase.php9
-rw-r--r--vendor/symfony/cache/Tests/Simple/ChainCacheTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Simple/FilesystemCacheTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php3
-rw-r--r--vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php3
-rw-r--r--vendor/symfony/cache/Tests/Simple/NullCacheTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Simple/PdoCacheTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php33
-rw-r--r--vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Simple/PhpArrayCacheWrapper.php46
-rw-r--r--vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php3
-rw-r--r--vendor/symfony/cache/Tests/Simple/Psr6CacheWithAdapterTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Simple/Psr6CacheWithoutAdapterTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php3
-rw-r--r--vendor/symfony/cache/Tests/Simple/RedisCacheTest.php3
-rw-r--r--vendor/symfony/cache/Tests/Simple/RedisClusterCacheTest.php3
-rw-r--r--vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php1
-rw-r--r--vendor/symfony/cache/Tests/Traits/TagAwareTestTrait.php160
39 files changed, 749 insertions, 173 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__);
}
diff --git a/vendor/symfony/cache/Tests/Adapter/FilesystemTagAwareAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/FilesystemTagAwareAdapterTest.php
new file mode 100644
index 0000000000..83a7ea52dd
--- /dev/null
+++ b/vendor/symfony/cache/Tests/Adapter/FilesystemTagAwareAdapterTest.php
@@ -0,0 +1,28 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Cache\Tests\Adapter;
+
+use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
+use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait;
+
+/**
+ * @group time-sensitive
+ */
+class FilesystemTagAwareAdapterTest extends FilesystemAdapterTest
+{
+ use TagAwareTestTrait;
+
+ public function createCachePool($defaultLifetime = 0)
+ {
+ return new FilesystemTagAwareAdapter('', $defaultLifetime);
+ }
+}
diff --git a/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php
index cee80ac196..3a5904b107 100644
--- a/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php
+++ b/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php
@@ -23,6 +23,7 @@ class PhpArrayAdapterTest extends AdapterTestCase
{
protected $skippedTests = [
'testGet' => 'PhpArrayAdapter is read-only.',
+ 'testRecursiveGet' => 'PhpArrayAdapter is read-only.',
'testBasicUsage' => 'PhpArrayAdapter is read-only.',
'testBasicUsageWithLongKey' => 'PhpArrayAdapter is read-only.',
'testClear' => 'PhpArrayAdapter is read-only.',
diff --git a/vendor/symfony/cache/Tests/Adapter/PredisTagAwareAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PredisTagAwareAdapterTest.php
new file mode 100644
index 0000000000..e321a1c9b8
--- /dev/null
+++ b/vendor/symfony/cache/Tests/Adapter/PredisTagAwareAdapterTest.php
@@ -0,0 +1,34 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Cache\Tests\Adapter;
+
+use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter;
+use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait;
+
+class PredisTagAwareAdapterTest extends PredisAdapterTest
+{
+ use TagAwareTestTrait;
+
+ protected function setUp()
+ {
+ parent::setUp();
+ $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
+ }
+
+ public function createCachePool($defaultLifetime = 0)
+ {
+ $this->assertInstanceOf(\Predis\Client::class, self::$redis);
+ $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
+
+ return $adapter;
+ }
+}
diff --git a/vendor/symfony/cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php
new file mode 100644
index 0000000000..a8a72e1de4
--- /dev/null
+++ b/vendor/symfony/cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php
@@ -0,0 +1,34 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Cache\Tests\Adapter;
+
+use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter;
+use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait;
+
+class PredisTagAwareClusterAdapterTest extends PredisClusterAdapterTest
+{
+ use TagAwareTestTrait;
+
+ protected function setUp()
+ {
+ parent::setUp();
+ $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
+ }
+
+ public function createCachePool($defaultLifetime = 0)
+ {
+ $this->assertInstanceOf(\Predis\Client::class, self::$redis);
+ $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
+
+ return $adapter;
+ }
+}
diff --git a/vendor/symfony/cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php
new file mode 100644
index 0000000000..5b82a80ecb
--- /dev/null
+++ b/vendor/symfony/cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php
@@ -0,0 +1,34 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Cache\Tests\Adapter;
+
+use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter;
+use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait;
+
+class PredisTagAwareRedisClusterAdapterTest extends PredisRedisClusterAdapterTest
+{
+ use TagAwareTestTrait;
+
+ protected function setUp()
+ {
+ parent::setUp();
+ $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
+ }
+
+ public function createCachePool($defaultLifetime = 0)
+ {
+ $this->assertInstanceOf(\Predis\Client::class, self::$redis);
+ $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
+
+ return $adapter;
+ }
+}
diff --git a/vendor/symfony/cache/Tests/Adapter/Psr16AdapterTest.php b/vendor/symfony/cache/Tests/Adapter/Psr16AdapterTest.php
new file mode 100644
index 0000000000..19907ddf78
--- /dev/null
+++ b/vendor/symfony/cache/Tests/Adapter/Psr16AdapterTest.php
@@ -0,0 +1,31 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Cache\Tests\Adapter;
+
+use Symfony\Component\Cache\Adapter\FilesystemAdapter;
+use Symfony\Component\Cache\Adapter\Psr16Adapter;
+use Symfony\Component\Cache\Psr16Cache;
+
+/**
+ * @group time-sensitive
+ */
+class Psr16AdapterTest extends AdapterTestCase
+{
+ protected $skippedTests = [
+ 'testPrune' => 'Psr16adapter just proxies',
+ ];
+
+ public function createCachePool($defaultLifetime = 0)
+ {
+ return new Psr16Adapter(new Psr16Cache(new FilesystemAdapter()), '', $defaultLifetime);
+ }
+}
diff --git a/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php
index c83abaf91b..4d9bc319eb 100644
--- a/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php
+++ b/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php
@@ -31,30 +31,33 @@ class RedisAdapterTest extends AbstractRedisAdapterTest
return $adapter;
}
- public function testCreateConnection()
+ /**
+ * @dataProvider provideValidSchemes
+ */
+ public function testCreateConnection($dsnScheme)
{
- $redis = RedisAdapter::createConnection('redis:?host[h1]&host[h2]&host[/foo:]');
+ $redis = RedisAdapter::createConnection($dsnScheme.':?host[h1]&host[h2]&host[/foo:]');
$this->assertInstanceOf(\RedisArray::class, $redis);
$this->assertSame(['h1:6379', 'h2:6379', '/foo'], $redis->_hosts());
@$redis = null; // some versions of phpredis connect on destruct, let's silence the warning
$redisHost = getenv('REDIS_HOST');
- $redis = RedisAdapter::createConnection('redis://'.$redisHost);
+ $redis = RedisAdapter::createConnection($dsnScheme.'://'.$redisHost);
$this->assertInstanceOf(\Redis::class, $redis);
$this->assertTrue($redis->isConnected());
$this->assertSame(0, $redis->getDbNum());
- $redis = RedisAdapter::createConnection('redis://'.$redisHost.'/2');
+ $redis = RedisAdapter::createConnection($dsnScheme.'://'.$redisHost.'/2');
$this->assertSame(2, $redis->getDbNum());
- $redis = RedisAdapter::createConnection('redis://'.$redisHost, ['timeout' => 3]);
+ $redis = RedisAdapter::createConnection($dsnScheme.'://'.$redisHost, ['timeout' => 3]);
$this->assertEquals(3, $redis->getTimeout());
- $redis = RedisAdapter::createConnection('redis://'.$redisHost.'?timeout=4');
+ $redis = RedisAdapter::createConnection($dsnScheme.'://'.$redisHost.'?timeout=4');
$this->assertEquals(4, $redis->getTimeout());
- $redis = RedisAdapter::createConnection('redis://'.$redisHost, ['read_timeout' => 5]);
+ $redis = RedisAdapter::createConnection($dsnScheme.'://'.$redisHost, ['read_timeout' => 5]);
$this->assertEquals(5, $redis->getReadTimeout());
}
@@ -87,6 +90,14 @@ class RedisAdapterTest extends AbstractRedisAdapterTest
RedisAdapter::createConnection($dsn);
}
+ public function provideValidSchemes()
+ {
+ return [
+ ['redis'],
+ ['rediss'],
+ ];
+ }
+
public function provideInvalidCreateConnection()
{
return [
diff --git a/vendor/symfony/cache/Tests/Adapter/RedisTagAwareAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/RedisTagAwareAdapterTest.php
new file mode 100644
index 0000000000..95e5fe7e3a
--- /dev/null
+++ b/vendor/symfony/cache/Tests/Adapter/RedisTagAwareAdapterTest.php
@@ -0,0 +1,35 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Cache\Tests\Adapter;
+
+use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter;
+use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait;
+use Symfony\Component\Cache\Traits\RedisProxy;
+
+class RedisTagAwareAdapterTest extends RedisAdapterTest
+{
+ use TagAwareTestTrait;
+
+ protected function setUp()
+ {
+ parent::setUp();
+ $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
+ }
+
+ public function createCachePool($defaultLifetime = 0)
+ {
+ $this->assertInstanceOf(RedisProxy::class, self::$redis);
+ $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
+
+ return $adapter;
+ }
+}
diff --git a/vendor/symfony/cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php
new file mode 100644
index 0000000000..5855cc3adf
--- /dev/null
+++ b/vendor/symfony/cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php
@@ -0,0 +1,34 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Cache\Tests\Adapter;
+
+use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter;
+use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait;
+
+class RedisTagAwareArrayAdapterTest extends RedisArrayAdapterTest
+{
+ use TagAwareTestTrait;
+
+ protected function setUp()
+ {
+ parent::setUp();
+ $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
+ }
+
+ public function createCachePool($defaultLifetime = 0)
+ {
+ $this->assertInstanceOf(\RedisArray::class, self::$redis);
+ $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
+
+ return $adapter;
+ }
+}
diff --git a/vendor/symfony/cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php
new file mode 100644
index 0000000000..ef17c1d69e
--- /dev/null
+++ b/vendor/symfony/cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php
@@ -0,0 +1,35 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Cache\Tests\Adapter;
+
+use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter;
+use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait;
+use Symfony\Component\Cache\Traits\RedisClusterProxy;
+
+class RedisTagAwareClusterAdapterTest extends RedisClusterAdapterTest
+{
+ use TagAwareTestTrait;
+
+ protected function setUp()
+ {
+ parent::setUp();
+ $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
+ }
+
+ public function createCachePool($defaultLifetime = 0)
+ {
+ $this->assertInstanceOf(RedisClusterProxy::class, self::$redis);
+ $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
+
+ return $adapter;
+ }
+}
diff --git a/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php
index 3028af47c6..b11f72d5a3 100644
--- a/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php
+++ b/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php
@@ -11,12 +11,12 @@
namespace Symfony\Component\Cache\Tests\Adapter;
-use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\SimpleCacheAdapter;
-use Symfony\Component\Cache\Simple\Psr6Cache;
+use Symfony\Component\Cache\Simple\FilesystemCache;
/**
* @group time-sensitive
+ * @group legacy
*/
class SimpleCacheAdapterTest extends AdapterTestCase
{
@@ -26,6 +26,6 @@ class SimpleCacheAdapterTest extends AdapterTestCase
public function createCachePool($defaultLifetime = 0)
{
- return new SimpleCacheAdapter(new Psr6Cache(new FilesystemAdapter()), '', $defaultLifetime);
+ return new SimpleCacheAdapter(new FilesystemCache(), '', $defaultLifetime);
}
}
diff --git a/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php
index 7b8895b700..a339790862 100644
--- a/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php
+++ b/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php
@@ -14,13 +14,15 @@ namespace Symfony\Component\Cache\Tests\Adapter;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
-use Symfony\Component\Cache\CacheItem;
+use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait;
/**
* @group time-sensitive
*/
class TagAwareAdapterTest extends AdapterTestCase
{
+ use TagAwareTestTrait;
+
public function createCachePool($defaultLifetime = 0)
{
return new TagAwareAdapter(new FilesystemAdapter('', $defaultLifetime));
@@ -32,53 +34,9 @@ class TagAwareAdapterTest extends AdapterTestCase
}
/**
- * @expectedException \Psr\Cache\InvalidArgumentException
+ * Test feature specific to TagAwareAdapter as it implicit needs to save deferred when also saving expiry info.
*/
- public function testInvalidTag()
- {
- $pool = $this->createCachePool();
- $item = $pool->getItem('foo');
- $item->tag(':');
- }
-
- public function testInvalidateTags()
- {
- $pool = $this->createCachePool();
-
- $i0 = $pool->getItem('i0');
- $i1 = $pool->getItem('i1');
- $i2 = $pool->getItem('i2');
- $i3 = $pool->getItem('i3');
- $foo = $pool->getItem('foo');
-
- $pool->save($i0->tag('bar'));
- $pool->save($i1->tag('foo'));
- $pool->save($i2->tag('foo')->tag('bar'));
- $pool->save($i3->tag('foo')->tag('baz'));
- $pool->save($foo);
-
- $pool->invalidateTags(['bar']);
-
- $this->assertFalse($pool->getItem('i0')->isHit());
- $this->assertTrue($pool->getItem('i1')->isHit());
- $this->assertFalse($pool->getItem('i2')->isHit());
- $this->assertTrue($pool->getItem('i3')->isHit());
- $this->assertTrue($pool->getItem('foo')->isHit());
-
- $pool->invalidateTags(['foo']);
-
- $this->assertFalse($pool->getItem('i1')->isHit());
- $this->assertFalse($pool->getItem('i3')->isHit());
- $this->assertTrue($pool->getItem('foo')->isHit());
-
- $anotherPoolInstance = $this->createCachePool();
-
- $this->assertFalse($anotherPoolInstance->getItem('i1')->isHit());
- $this->assertFalse($anotherPoolInstance->getItem('i3')->isHit());
- $this->assertTrue($anotherPoolInstance->getItem('foo')->isHit());
- }
-
- public function testInvalidateCommits()
+ public function testInvalidateCommitsSeperatePools()
{
$pool1 = $this->createCachePool();
@@ -94,76 +52,6 @@ class TagAwareAdapterTest extends AdapterTestCase
$this->assertTrue($foo->isHit());
}
- public function testTagsAreCleanedOnSave()
- {
- $pool = $this->createCachePool();
-
- $i = $pool->getItem('k');
- $pool->save($i->tag('foo'));
-
- $i = $pool->getItem('k');
- $pool->save($i->tag('bar'));
-
- $pool->invalidateTags(['foo']);
- $this->assertTrue($pool->getItem('k')->isHit());
- }
-
- public function testTagsAreCleanedOnDelete()
- {
- $pool = $this->createCachePool();
-
- $i = $pool->getItem('k');
- $pool->save($i->tag('foo'));
- $pool->deleteItem('k');
-
- $pool->save($pool->getItem('k'));
- $pool->invalidateTags(['foo']);
-
- $this->assertTrue($pool->getItem('k')->isHit());
- }
-
- public function testTagItemExpiry()
- {
- $pool = $this->createCachePool(10);
-
- $item = $pool->getItem('foo');
- $item->tag(['baz']);
- $item->expiresAfter(100);
-
- $pool->save($item);
- $pool->invalidateTags(['baz']);
- $this->assertFalse($pool->getItem('foo')->isHit());
-
- sleep(20);
-
- $this->assertFalse($pool->getItem('foo')->isHit());
- }
-
- /**
- * @group legacy
- */
- public function testGetPreviousTags()
- {
- $pool = $this->createCachePool();
-
- $i = $pool->getItem('k');
- $pool->save($i->tag('foo'));
-
- $i = $pool->getItem('k');
- $this->assertSame(['foo' => 'foo'], $i->getPreviousTags());
- }
-
- public function testGetMetadata()
- {
- $pool = $this->createCachePool();
-
- $i = $pool->getItem('k');
- $pool->save($i->tag('foo'));
-
- $i = $pool->getItem('k');
- $this->assertSame(['foo' => 'foo'], $i->getMetadata()[CacheItem::METADATA_TAGS]);
- }
-
public function testPrune()
{
$cache = new TagAwareAdapter($this->getPruneableMock());
diff --git a/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPassTest.php b/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPassTest.php
index f307aa5386..4681b3dc81 100644
--- a/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPassTest.php
+++ b/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPassTest.php
@@ -13,6 +13,7 @@ namespace Symfony\Component\Cache\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
+use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\DependencyInjection\CachePoolPass;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -48,6 +49,27 @@ class CachePoolPassTest extends TestCase
$this->assertSame('z3X945Jbf5', $cachePool->getArgument(0));
}
+ public function testNamespaceArgumentIsSeededWithAdapterClassName()
+ {
+ $container = new ContainerBuilder();
+ $container->setParameter('kernel.container_class', 'app');
+ $container->setParameter('kernel.project_dir', 'foo');
+ $adapter = new Definition();
+ $adapter->setAbstract(true);
+ $adapter->addTag('cache.pool');
+ $adapter->setClass(RedisAdapter::class);
+ $container->setDefinition('app.cache_adapter', $adapter);
+ $container->setAlias('app.cache_adapter_alias', 'app.cache_adapter');
+ $cachePool = new ChildDefinition('app.cache_adapter_alias');
+ $cachePool->addArgument(null);
+ $cachePool->addTag('cache.pool');
+ $container->setDefinition('app.cache_pool', $cachePool);
+
+ $this->cachePoolPass->process($container);
+
+ $this->assertSame('xmOJ8gqF-Y', $cachePool->getArgument(0));
+ }
+
public function testNamespaceArgumentIsNotReplacedIfArrayAdapterIsUsed()
{
$container = new ContainerBuilder();
diff --git a/vendor/symfony/cache/Tests/Psr16CacheTest.php b/vendor/symfony/cache/Tests/Psr16CacheTest.php
new file mode 100644
index 0000000000..e56d99e441
--- /dev/null
+++ b/vendor/symfony/cache/Tests/Psr16CacheTest.php
@@ -0,0 +1,168 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Cache\Tests;
+
+use Cache\IntegrationTests\SimpleCacheTest;
+use Symfony\Component\Cache\Adapter\FilesystemAdapter;
+use Symfony\Component\Cache\PruneableInterface;
+use Symfony\Component\Cache\Psr16Cache;
+
+/**
+ * @group time-sensitive
+ */
+class Psr16CacheTest extends SimpleCacheTest
+{
+ protected function setUp()
+ {
+ parent::setUp();
+
+ if (\array_key_exists('testPrune', $this->skippedTests)) {
+ return;
+ }
+
+ $pool = $this->createSimpleCache();
+ if ($pool instanceof Psr16Cache) {
+ $pool = ((array) $pool)[sprintf("\0%s\0pool", Psr16Cache::class)];
+ }
+
+ if (!$pool instanceof PruneableInterface) {
+ $this->skippedTests['testPrune'] = 'Not a pruneable cache pool.';
+ }
+ }
+
+ public function createSimpleCache($defaultLifetime = 0)
+ {
+ return new Psr16Cache(new FilesystemAdapter('', $defaultLifetime));
+ }
+
+ public static function validKeys()
+ {
+ return array_merge(parent::validKeys(), [["a\0b"]]);
+ }
+
+ public function testDefaultLifeTime()
+ {
+ if (isset($this->skippedTests[__FUNCTION__])) {
+ $this->markTestSkipped($this->skippedTests[__FUNCTION__]);
+ }
+
+ $cache = $this->createSimpleCache(2);
+ $cache->clear();
+
+ $cache->set('key.dlt', 'value');
+ sleep(1);
+
+ $this->assertSame('value', $cache->get('key.dlt'));
+
+ sleep(2);
+ $this->assertNull($cache->get('key.dlt'));
+
+ $cache->clear();
+ }
+
+ public function testNotUnserializable()
+ {
+ if (isset($this->skippedTests[__FUNCTION__])) {
+ $this->markTestSkipped($this->skippedTests[__FUNCTION__]);
+ }
+
+ $cache = $this->createSimpleCache();
+ $cache->clear();
+
+ $cache->set('foo', new NotUnserializable());
+
+ $this->assertNull($cache->get('foo'));
+
+ $cache->setMultiple(['foo' => new NotUnserializable()]);
+
+ foreach ($cache->getMultiple(['foo']) as $value) {
+ }
+ $this->assertNull($value);
+
+ $cache->clear();
+ }
+
+ public function testPrune()
+ {
+ if (isset($this->skippedTests[__FUNCTION__])) {
+ $this->markTestSkipped($this->skippedTests[__FUNCTION__]);
+ }
+
+ /** @var PruneableInterface|CacheInterface $cache */
+ $cache = $this->createSimpleCache();
+ $cache->clear();
+
+ $cache->set('foo', 'foo-val', new \DateInterval('PT05S'));
+ $cache->set('bar', 'bar-val', new \DateInterval('PT10S'));
+ $cache->set('baz', 'baz-val', new \DateInterval('PT15S'));
+ $cache->set('qux', 'qux-val', new \DateInterval('PT20S'));
+
+ sleep(30);
+ $cache->prune();
+ $this->assertTrue($this->isPruned($cache, 'foo'));
+ $this->assertTrue($this->isPruned($cache, 'bar'));
+ $this->assertTrue($this->isPruned($cache, 'baz'));
+ $this->assertTrue($this->isPruned($cache, 'qux'));
+
+ $cache->set('foo', 'foo-val');
+ $cache->set('bar', 'bar-val', new \DateInterval('PT20S'));
+ $cache->set('baz', 'baz-val', new \DateInterval('PT40S'));
+ $cache->set('qux', 'qux-val', new \DateInterval('PT80S'));
+
+ $cache->prune();
+ $this->assertFalse($this->isPruned($cache, 'foo'));
+ $this->assertFalse($this->isPruned($cache, 'bar'));
+ $this->assertFalse($this->isPruned($cache, 'baz'));
+ $this->assertFalse($this->isPruned($cache, 'qux'));
+
+ sleep(30);
+ $cache->prune();
+ $this->assertFalse($this->isPruned($cache, 'foo'));
+ $this->assertTrue($this->isPruned($cache, 'bar'));
+ $this->assertFalse($this->isPruned($cache, 'baz'));
+ $this->assertFalse($this->isPruned($cache, 'qux'));
+
+ sleep(30);
+ $cache->prune();
+ $this->assertFalse($this->isPruned($cache, 'foo'));
+ $this->assertTrue($this->isPruned($cache, 'baz'));
+ $this->assertFalse($this->isPruned($cache, 'qux'));
+
+ sleep(30);
+ $cache->prune();
+ $this->assertFalse($this->isPruned($cache, 'foo'));
+ $this->assertTrue($this->isPruned($cache, 'qux'));
+
+ $cache->clear();
+ }
+
+ protected function isPruned($cache, $name)
+ {
+ if (Psr16Cache::class !== \get_class($cache)) {
+ $this->fail('Test classes for pruneable caches must implement `isPruned($cache, $name)` method.');
+ }
+
+ $pool = ((array) $cache)[sprintf("\0%s\0pool", Psr16Cache::class)];
+ $getFileMethod = (new \ReflectionObject($pool))->getMethod('getFile');
+ $getFileMethod->setAccessible(true);
+
+ return !file_exists($getFileMethod->invoke($pool, $name));
+ }
+}
+
+class NotUnserializable
+{
+ public function __wakeup()
+ {
+ throw new \Exception(__CLASS__);
+ }
+}
diff --git a/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php b/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php
index dd5e1509c1..a9f5d98b92 100644
--- a/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php
@@ -13,6 +13,9 @@ namespace Symfony\Component\Cache\Tests\Simple;
use Symfony\Component\Cache\Simple\RedisCache;
+/**
+ * @group legacy
+ */
abstract class AbstractRedisCacheTest extends CacheTestCase
{
protected $skippedTests = [
diff --git a/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php b/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php
index f37b95a093..b322094603 100644
--- a/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php
@@ -13,6 +13,9 @@ namespace Symfony\Component\Cache\Tests\Simple;
use Symfony\Component\Cache\Simple\ApcuCache;
+/**
+ * @group legacy
+ */
class ApcuCacheTest extends CacheTestCase
{
protected $skippedTests = [
diff --git a/vendor/symfony/cache/Tests/Simple/ArrayCacheTest.php b/vendor/symfony/cache/Tests/Simple/ArrayCacheTest.php
index 26c3e14d09..587304a5db 100644
--- a/vendor/symfony/cache/Tests/Simple/ArrayCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/ArrayCacheTest.php
@@ -15,6 +15,7 @@ use Symfony\Component\Cache\Simple\ArrayCache;
/**
* @group time-sensitive
+ * @group legacy
*/
class ArrayCacheTest extends CacheTestCase
{
diff --git a/vendor/symfony/cache/Tests/Simple/CacheTestCase.php b/vendor/symfony/cache/Tests/Simple/CacheTestCase.php
index 3c8824869b..d4b3d07f62 100644
--- a/vendor/symfony/cache/Tests/Simple/CacheTestCase.php
+++ b/vendor/symfony/cache/Tests/Simple/CacheTestCase.php
@@ -132,14 +132,9 @@ abstract class CacheTestCase extends SimpleCacheTest
}
}
-class NotUnserializable implements \Serializable
+class NotUnserializable
{
- public function serialize()
- {
- return serialize(123);
- }
-
- public function unserialize($ser)
+ public function __wakeup()
{
throw new \Exception(__CLASS__);
}
diff --git a/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php b/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php
index e6f7c7cc63..806bb7633b 100644
--- a/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php
@@ -19,6 +19,7 @@ use Symfony\Component\Cache\Simple\FilesystemCache;
/**
* @group time-sensitive
+ * @group legacy
*/
class ChainCacheTest extends CacheTestCase
{
diff --git a/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php b/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php
index af4331d69b..5d78c00cac 100644
--- a/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php
@@ -16,6 +16,7 @@ use Symfony\Component\Cache\Tests\Fixtures\ArrayCache;
/**
* @group time-sensitive
+ * @group legacy
*/
class DoctrineCacheTest extends CacheTestCase
{
diff --git a/vendor/symfony/cache/Tests/Simple/FilesystemCacheTest.php b/vendor/symfony/cache/Tests/Simple/FilesystemCacheTest.php
index 620305a58a..9f423ba641 100644
--- a/vendor/symfony/cache/Tests/Simple/FilesystemCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/FilesystemCacheTest.php
@@ -16,6 +16,7 @@ use Symfony\Component\Cache\Simple\FilesystemCache;
/**
* @group time-sensitive
+ * @group legacy
*/
class FilesystemCacheTest extends CacheTestCase
{
diff --git a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php
index f83f0a2e34..692259296f 100644
--- a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php
@@ -14,6 +14,9 @@ namespace Symfony\Component\Cache\Tests\Simple;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Simple\MemcachedCache;
+/**
+ * @group legacy
+ */
class MemcachedCacheTest extends CacheTestCase
{
protected $skippedTests = [
diff --git a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php
index 13865a6098..d68131a1db 100644
--- a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php
+++ b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php
@@ -14,6 +14,9 @@ namespace Symfony\Component\Cache\Tests\Simple;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Simple\MemcachedCache;
+/**
+ * @group legacy
+ */
class MemcachedCacheTextModeTest extends MemcachedCacheTest
{
public function createSimpleCache($defaultLifetime = 0)
diff --git a/vendor/symfony/cache/Tests/Simple/NullCacheTest.php b/vendor/symfony/cache/Tests/Simple/NullCacheTest.php
index 31f42c32b6..cf0dde92b3 100644
--- a/vendor/symfony/cache/Tests/Simple/NullCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/NullCacheTest.php
@@ -16,6 +16,7 @@ use Symfony\Component\Cache\Simple\NullCache;
/**
* @group time-sensitive
+ * @group legacy
*/
class NullCacheTest extends TestCase
{
diff --git a/vendor/symfony/cache/Tests/Simple/PdoCacheTest.php b/vendor/symfony/cache/Tests/Simple/PdoCacheTest.php
index 665db09f67..fbdf03be7e 100644
--- a/vendor/symfony/cache/Tests/Simple/PdoCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/PdoCacheTest.php
@@ -16,6 +16,7 @@ use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
/**
* @group time-sensitive
+ * @group legacy
*/
class PdoCacheTest extends CacheTestCase
{
diff --git a/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php b/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php
index ce1a9ae4f8..af5c42340b 100644
--- a/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php
@@ -17,6 +17,7 @@ use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
/**
* @group time-sensitive
+ * @group legacy
*/
class PdoDbalCacheTest extends CacheTestCase
{
diff --git a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php
index ba4bde3139..5272604dc3 100644
--- a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php
@@ -17,6 +17,7 @@ use Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest;
/**
* @group time-sensitive
+ * @group legacy
*/
class PhpArrayCacheTest extends CacheTestCase
{
@@ -127,35 +128,3 @@ class PhpArrayCacheTest extends CacheTestCase
$this->assertSame($expected, $values, 'Warm up should create a PHP file that OPCache can load in memory');
}
}
-
-class PhpArrayCacheWrapper extends PhpArrayCache
-{
- protected $data = [];
-
- public function set($key, $value, $ttl = null)
- {
- (\Closure::bind(function () use ($key, $value) {
- $this->data[$key] = $value;
- $this->warmUp($this->data);
- list($this->keys, $this->values) = eval(substr(file_get_contents($this->file), 6));
- }, $this, PhpArrayCache::class))();
-
- return true;
- }
-
- public function setMultiple($values, $ttl = null)
- {
- if (!\is_array($values) && !$values instanceof \Traversable) {
- return parent::setMultiple($values, $ttl);
- }
- (\Closure::bind(function () use ($values) {
- foreach ($values as $key => $value) {
- $this->data[$key] = $value;
- }
- $this->warmUp($this->data);
- list($this->keys, $this->values) = eval(substr(file_get_contents($this->file), 6));
- }, $this, PhpArrayCache::class))();
-
- return true;
- }
-}
diff --git a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php
index abee5e7872..90aa7bb6ef 100644
--- a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php
+++ b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php
@@ -17,6 +17,7 @@ use Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest;
/**
* @group time-sensitive
+ * @group legacy
*/
class PhpArrayCacheWithFallbackTest extends CacheTestCase
{
diff --git a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWrapper.php b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWrapper.php
new file mode 100644
index 0000000000..1e102fe1ff
--- /dev/null
+++ b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWrapper.php
@@ -0,0 +1,46 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Cache\Tests\Simple;
+
+use Symfony\Component\Cache\Simple\PhpArrayCache;
+
+class PhpArrayCacheWrapper extends PhpArrayCache
+{
+ protected $data = [];
+
+ public function set($key, $value, $ttl = null)
+ {
+ (\Closure::bind(function () use ($key, $value) {
+ $this->data[$key] = $value;
+ $this->warmUp($this->data);
+ list($this->keys, $this->values) = eval(substr(file_get_contents($this->file), 6));
+ }, $this, PhpArrayCache::class))();
+
+ return true;
+ }
+
+ public function setMultiple($values, $ttl = null)
+ {
+ if (!\is_array($values) && !$values instanceof \Traversable) {
+ return parent::setMultiple($values, $ttl);
+ }
+ (\Closure::bind(function () use ($values) {
+ foreach ($values as $key => $value) {
+ $this->data[$key] = $value;
+ }
+ $this->warmUp($this->data);
+ list($this->keys, $this->values) = eval(substr(file_get_contents($this->file), 6));
+ }, $this, PhpArrayCache::class))();
+
+ return true;
+ }
+}
diff --git a/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php b/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php
index 3a68dd3984..7e40df7de5 100644
--- a/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php
@@ -16,6 +16,7 @@ use Symfony\Component\Cache\Simple\PhpFilesCache;
/**
* @group time-sensitive
+ * @group legacy
*/
class PhpFilesCacheTest extends CacheTestCase
{
diff --git a/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php b/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php
index 65d48a978c..9fff36e402 100644
--- a/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php
@@ -13,6 +13,9 @@ namespace Symfony\Component\Cache\Tests\Simple;
use Symfony\Component\Cache\Simple\Psr6Cache;
+/**
+ * @group legacy
+ */
abstract class Psr6CacheTest extends CacheTestCase
{
protected $skippedTests = [
diff --git a/vendor/symfony/cache/Tests/Simple/Psr6CacheWithAdapterTest.php b/vendor/symfony/cache/Tests/Simple/Psr6CacheWithAdapterTest.php
index 46da9354d6..e5c7a6a4c7 100644
--- a/vendor/symfony/cache/Tests/Simple/Psr6CacheWithAdapterTest.php
+++ b/vendor/symfony/cache/Tests/Simple/Psr6CacheWithAdapterTest.php
@@ -15,6 +15,7 @@ use Symfony\Component\Cache\Adapter\FilesystemAdapter;
/**
* @group time-sensitive
+ * @group legacy
*/
class Psr6CacheWithAdapterTest extends Psr6CacheTest
{
diff --git a/vendor/symfony/cache/Tests/Simple/Psr6CacheWithoutAdapterTest.php b/vendor/symfony/cache/Tests/Simple/Psr6CacheWithoutAdapterTest.php
index a8c4164dcb..f987d40539 100644
--- a/vendor/symfony/cache/Tests/Simple/Psr6CacheWithoutAdapterTest.php
+++ b/vendor/symfony/cache/Tests/Simple/Psr6CacheWithoutAdapterTest.php
@@ -15,6 +15,7 @@ use Symfony\Component\Cache\Tests\Fixtures\ExternalAdapter;
/**
* @group time-sensitive
+ * @group legacy
*/
class Psr6CacheWithoutAdapterTest extends Psr6CacheTest
{
diff --git a/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php b/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php
index bda39d990b..b52f5f9acd 100644
--- a/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php
@@ -11,6 +11,9 @@
namespace Symfony\Component\Cache\Tests\Simple;
+/**
+ * @group legacy
+ */
class RedisArrayCacheTest extends AbstractRedisCacheTest
{
public static function setupBeforeClass()
diff --git a/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php b/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php
index 407d916c73..ddb674b285 100644
--- a/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php
@@ -13,6 +13,9 @@ namespace Symfony\Component\Cache\Tests\Simple;
use Symfony\Component\Cache\Simple\RedisCache;
+/**
+ * @group legacy
+ */
class RedisCacheTest extends AbstractRedisCacheTest
{
public static function setupBeforeClass()
diff --git a/vendor/symfony/cache/Tests/Simple/RedisClusterCacheTest.php b/vendor/symfony/cache/Tests/Simple/RedisClusterCacheTest.php
index 99d4e518fb..33c7acae0b 100644
--- a/vendor/symfony/cache/Tests/Simple/RedisClusterCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/RedisClusterCacheTest.php
@@ -11,6 +11,9 @@
namespace Symfony\Component\Cache\Tests\Simple;
+/**
+ * @group legacy
+ */
class RedisClusterCacheTest extends AbstractRedisCacheTest
{
public static function setupBeforeClass()
diff --git a/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php b/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php
index e684caf36e..c2e8a477b4 100644
--- a/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php
+++ b/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php
@@ -16,6 +16,7 @@ use Symfony\Component\Cache\Simple\TraceableCache;
/**
* @group time-sensitive
+ * @group legacy
*/
class TraceableCacheTest extends CacheTestCase
{
diff --git a/vendor/symfony/cache/Tests/Traits/TagAwareTestTrait.php b/vendor/symfony/cache/Tests/Traits/TagAwareTestTrait.php
new file mode 100644
index 0000000000..38cc4dc9cc
--- /dev/null
+++ b/vendor/symfony/cache/Tests/Traits/TagAwareTestTrait.php
@@ -0,0 +1,160 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Cache\Tests\Traits;
+
+use Symfony\Component\Cache\CacheItem;
+
+/**
+ * Common assertions for TagAware adapters.
+ *
+ * @method \Symfony\Component\Cache\Adapter\TagAwareAdapterInterface createCachePool() Must be implemented by TestCase
+ */
+trait TagAwareTestTrait
+{
+ /**
+ * @expectedException \Psr\Cache\InvalidArgumentException
+ */
+ public function testInvalidTag()
+ {
+ $pool = $this->createCachePool();
+ $item = $pool->getItem('foo');
+ $item->tag(':');
+ }
+
+ public function testInvalidateTags()
+ {
+ $pool = $this->createCachePool();
+
+ $i0 = $pool->getItem('i0');
+ $i1 = $pool->getItem('i1');
+ $i2 = $pool->getItem('i2');
+ $i3 = $pool->getItem('i3');
+ $foo = $pool->getItem('foo');
+
+ $pool->save($i0->tag('bar'));
+ $pool->save($i1->tag('foo'));
+ $pool->save($i2->tag('foo')->tag('bar'));
+ $pool->save($i3->tag('foo')->tag('baz'));
+ $pool->save($foo);
+
+ $pool->invalidateTags(['bar']);
+
+ $this->assertFalse($pool->getItem('i0')->isHit());
+ $this->assertTrue($pool->getItem('i1')->isHit());
+ $this->assertFalse($pool->getItem('i2')->isHit());
+ $this->assertTrue($pool->getItem('i3')->isHit());
+ $this->assertTrue($pool->getItem('foo')->isHit());
+
+ $pool->invalidateTags(['foo']);
+
+ $this->assertFalse($pool->getItem('i1')->isHit());
+ $this->assertFalse($pool->getItem('i3')->isHit());
+ $this->assertTrue($pool->getItem('foo')->isHit());
+
+ $anotherPoolInstance = $this->createCachePool();
+
+ $this->assertFalse($anotherPoolInstance->getItem('i1')->isHit());
+ $this->assertFalse($anotherPoolInstance->getItem('i3')->isHit());
+ $this->assertTrue($anotherPoolInstance->getItem('foo')->isHit());
+ }
+
+ public function testInvalidateCommits()
+ {
+ $pool = $this->createCachePool();
+
+ $foo = $pool->getItem('foo');
+ $foo->tag('tag');
+
+ $pool->saveDeferred($foo->set('foo'));
+ $pool->invalidateTags(['tag']);
+
+ // ??: This seems to contradict a bit logic in deleteItems, where it does unset($this->deferred[$key]); on key matches
+
+ $foo = $pool->getItem('foo');
+
+ $this->assertTrue($foo->isHit());
+ }
+
+ public function testTagsAreCleanedOnSave()
+ {
+ $pool = $this->createCachePool();
+
+ $i = $pool->getItem('k');
+ $pool->save($i->tag('foo'));
+
+ $i = $pool->getItem('k');
+ $pool->save($i->tag('bar'));
+
+ $pool->invalidateTags(['foo']);
+ $this->assertTrue($pool->getItem('k')->isHit());
+ }
+
+ public function testTagsAreCleanedOnDelete()
+ {
+ $pool = $this->createCachePool();
+
+ $i = $pool->getItem('k');
+ $pool->save($i->tag('foo'));
+ $pool->deleteItem('k');
+
+ $pool->save($pool->getItem('k'));
+ $pool->invalidateTags(['foo']);
+
+ $this->assertTrue($pool->getItem('k')->isHit());
+ }
+
+ public function testTagItemExpiry()
+ {
+ if (isset($this->skippedTests[__FUNCTION__])) {
+ $this->markTestSkipped($this->skippedTests[__FUNCTION__]);
+ }
+
+ $pool = $this->createCachePool(10);
+
+ $item = $pool->getItem('foo');
+ $item->tag(['baz']);
+ $item->expiresAfter(100);
+
+ $pool->save($item);
+ $pool->invalidateTags(['baz']);
+ $this->assertFalse($pool->getItem('foo')->isHit());
+
+ sleep(20);
+
+ $this->assertFalse($pool->getItem('foo')->isHit());
+ }
+
+ /**
+ * @group legacy
+ */
+ public function testGetPreviousTags()
+ {
+ $pool = $this->createCachePool();
+
+ $i = $pool->getItem('k');
+ $pool->save($i->tag('foo'));
+
+ $i = $pool->getItem('k');
+ $this->assertSame(['foo' => 'foo'], $i->getPreviousTags());
+ }
+
+ public function testGetMetadata()
+ {
+ $pool = $this->createCachePool();
+
+ $i = $pool->getItem('k');
+ $pool->save($i->tag('foo'));
+
+ $i = $pool->getItem('k');
+ $this->assertSame(['foo' => 'foo'], $i->getMetadata()[CacheItem::METADATA_TAGS]);
+ }
+}