Skip to content

Commit 273f1b7

Browse files
a.dmitryuknicolas-grekas
authored andcommitted
[Cache] Fix NullAdapter must set taggable
1 parent 93ea5f6 commit 273f1b7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Symfony/Component/Cache/Adapter/NullAdapter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function __construct()
2828
self::$createCacheItem ??= \Closure::bind(
2929
static function ($key) {
3030
$item = new CacheItem();
31+
$item->isTaggable = true;
3132
$item->key = $key;
3233
$item->isHit = false;
3334

src/Symfony/Component/Cache/Tests/Adapter/NullAdapterTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,15 @@ public function testCommit()
138138
$this->assertTrue($this->createCachePool()->commit());
139139
}
140140

141+
public function testTaggable()
142+
{
143+
$this->expectNotToPerformAssertions();
144+
$adapter = $this->createCachePool();
145+
$item = $adapter->getItem('any_item');
146+
// No error triggered 'Cache item "%s" comes from a non tag-aware pool: you cannot tag it.'
147+
$item->tag(['tag1']);
148+
}
149+
141150
public function testInvalidateTags()
142151
{
143152
$adapter = $this->createCachePool();

0 commit comments

Comments
 (0)