diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-11-04 23:56:19 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-11-04 23:56:19 +0000 |
| commit | 09a0b4fc622e4780bc0c9e9dd7ec6a13a03dbf4f (patch) | |
| tree | 93468cbf4a24a1f025c22abb102757081892503b /vendor/symfony/cache/Tests | |
| parent | 35b016d961c6f782ac75e89afa6ca4acd0773662 (diff) | |
| download | webtrees-09a0b4fc622e4780bc0c9e9dd7ec6a13a03dbf4f.tar.gz webtrees-09a0b4fc622e4780bc0c9e9dd7ec6a13a03dbf4f.tar.bz2 webtrees-09a0b4fc622e4780bc0c9e9dd7ec6a13a03dbf4f.zip | |
Update vendor dependencies
Diffstat (limited to 'vendor/symfony/cache/Tests')
5 files changed, 82 insertions, 6 deletions
diff --git a/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php b/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php index 63a7f39e53..a6132ebca2 100644 --- a/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php +++ b/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php @@ -87,8 +87,8 @@ abstract class AdapterTestCase extends CachePoolTest $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; }); + $cache->get('k2', function () use (&$counter) { return ++$counter; }); + $v = $cache->get('k2', function () use (&$counter) { return ++$counter; }); // ensure the callback is called once return $v; }); diff --git a/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php index 724aa9451c..8d0b70d619 100644 --- a/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php @@ -70,7 +70,7 @@ class MaxIdLengthAdapterTest extends TestCase { $this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException'); $this->expectExceptionMessage('Namespace must be 26 chars max, 40 given ("----------------------------------------")'); - $cache = $this->getMockBuilder(MaxIdLengthAdapter::class) + $this->getMockBuilder(MaxIdLengthAdapter::class) ->setConstructorArgs([str_repeat('-', 40)]) ->getMock(); } diff --git a/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php index 6c5710a7e4..ae3de76dc1 100644 --- a/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php @@ -39,7 +39,7 @@ class NullAdapterTest extends TestCase $adapter = $this->createCachePool(); $fetched = []; - $item = $adapter->get('myKey', function ($item) use (&$fetched) { $fetched[] = $item; }); + $adapter->get('myKey', function ($item) use (&$fetched) { $fetched[] = $item; }); $this->assertCount(1, $fetched); $item = $fetched[0]; $this->assertFalse($item->isHit()); diff --git a/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php index 573a1b1d01..d4071baedb 100644 --- a/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php @@ -31,8 +31,6 @@ class PdoDbalAdapterTest extends AdapterTestCase } self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache'); - - $pool = new PdoAdapter(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile])); } public static function tearDownAfterClass(): void diff --git a/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php index ef939bae8c..b4e1ebbcd8 100644 --- a/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php @@ -99,6 +99,84 @@ class TagAwareAdapterTest extends AdapterTestCase $this->assertTrue($pool->getItem('foo')->isHit()); } + public function testTagEntryIsCreatedForItemWithoutTags() + { + $pool = $this->createCachePool(); + + $itemKey = 'foo'; + $item = $pool->getItem($itemKey); + $pool->save($item); + + $adapter = new FilesystemAdapter(); + $this->assertTrue($adapter->hasItem(TagAwareAdapter::TAGS_PREFIX.$itemKey)); + } + + public function testHasItemReturnsFalseWhenPoolDoesNotHaveItemTags() + { + $pool = $this->createCachePool(); + + $itemKey = 'foo'; + $item = $pool->getItem($itemKey); + $pool->save($item); + + $anotherPool = $this->createCachePool(); + + $adapter = new FilesystemAdapter(); + $adapter->deleteItem(TagAwareAdapter::TAGS_PREFIX.$itemKey); //simulate item losing tags pair + + $this->assertFalse($anotherPool->hasItem($itemKey)); + } + + public function testGetItemReturnsCacheMissWhenPoolDoesNotHaveItemTags() + { + $pool = $this->createCachePool(); + + $itemKey = 'foo'; + $item = $pool->getItem($itemKey); + $pool->save($item); + + $anotherPool = $this->createCachePool(); + + $adapter = new FilesystemAdapter(); + $adapter->deleteItem(TagAwareAdapter::TAGS_PREFIX.$itemKey); //simulate item losing tags pair + + $item = $anotherPool->getItem($itemKey); + $this->assertFalse($item->isHit()); + } + + public function testHasItemReturnsFalseWhenPoolDoesNotHaveItemAndOnlyHasTags() + { + $pool = $this->createCachePool(); + + $itemKey = 'foo'; + $item = $pool->getItem($itemKey); + $pool->save($item); + + $anotherPool = $this->createCachePool(); + + $adapter = new FilesystemAdapter(); + $adapter->deleteItem($itemKey); //simulate losing item but keeping tags + + $this->assertFalse($anotherPool->hasItem($itemKey)); + } + + public function testGetItemReturnsCacheMissWhenPoolDoesNotHaveItemAndOnlyHasTags() + { + $pool = $this->createCachePool(); + + $itemKey = 'foo'; + $item = $pool->getItem($itemKey); + $pool->save($item); + + $anotherPool = $this->createCachePool(); + + $adapter = new FilesystemAdapter(); + $adapter->deleteItem($itemKey); //simulate losing item but keeping tags + + $item = $anotherPool->getItem($itemKey); + $this->assertFalse($item->isHit()); + } + /** * @return MockObject|PruneableCacheInterface */ |
