mirror of
https://github.com/symfony/cache.git
synced 2026-03-23 23:22:07 +01:00
[Cache] Fix NullAdapter must set taggable
This commit is contained in:
committed by
Nicolas Grekas
parent
8b9948a828
commit
8f9fdb4254
@@ -28,6 +28,7 @@ class NullAdapter implements AdapterInterface, CacheInterface, NamespacedPoolInt
|
||||
self::$createCacheItem ??= \Closure::bind(
|
||||
static function ($key) {
|
||||
$item = new CacheItem();
|
||||
$item->isTaggable = true;
|
||||
$item->key = $key;
|
||||
$item->isHit = false;
|
||||
|
||||
|
||||
@@ -138,6 +138,15 @@ class NullAdapterTest extends TestCase
|
||||
$this->assertTrue($this->createCachePool()->commit());
|
||||
}
|
||||
|
||||
public function testTaggable()
|
||||
{
|
||||
$this->expectNotToPerformAssertions();
|
||||
$adapter = $this->createCachePool();
|
||||
$item = $adapter->getItem('any_item');
|
||||
// No error triggered 'Cache item "%s" comes from a non tag-aware pool: you cannot tag it.'
|
||||
$item->tag(['tag1']);
|
||||
}
|
||||
|
||||
public function testInvalidateTags()
|
||||
{
|
||||
$adapter = $this->createCachePool();
|
||||
|
||||
Reference in New Issue
Block a user