From ebc78001b4d90aa56341167ebe2e492ab61f762c Mon Sep 17 00:00:00 2001 From: Peter Todorov Date: Mon, 30 Apr 2018 20:58:55 +0300 Subject: [PATCH 1/2] Fixed typo in variable name --- src/Storage/Adapter/Filesystem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Storage/Adapter/Filesystem.php b/src/Storage/Adapter/Filesystem.php index db529dda1..98aae5151 100644 --- a/src/Storage/Adapter/Filesystem.php +++ b/src/Storage/Adapter/Filesystem.php @@ -327,7 +327,7 @@ public function setTags($key, array $tags) $filespec = $this->getFileSpec($key); if (! $tags) { - $this->unlink($this->formatTagFilename($filespac)); + $this->unlink($this->formatTagFilename($filespec)); return true; } From b187de2271d08051911d9ed6f49e2d9a1d358c13 Mon Sep 17 00:00:00 2001 From: Peter Todorov Date: Tue, 1 May 2018 22:39:30 +0300 Subject: [PATCH 2/2] Added filesystem adapter test to check that passing an empty array to setTags clears the tags --- test/Storage/Adapter/FilesystemTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/Storage/Adapter/FilesystemTest.php b/test/Storage/Adapter/FilesystemTest.php index b0693ab54..602ae7123 100644 --- a/test/Storage/Adapter/FilesystemTest.php +++ b/test/Storage/Adapter/FilesystemTest.php @@ -608,4 +608,15 @@ public function testTagSuffixIsMutable() $this->_options->setTagSuffix('.cache'); $this->assertSame('.cache', $this->_options->getTagSuffix()); } + + public function testEmptyTagsArrayClearsTags() + { + $key = 'key'; + $tags = ['tag1', 'tag2', 'tag3']; + $this->assertTrue($this->_storage->setItem($key, 100)); + $this->assertTrue($this->_storage->setTags($key, $tags)); + $this->assertNotEmpty($this->_storage->getTags($key)); + $this->assertTrue($this->_storage->setTags($key, [])); + $this->assertEmpty($this->_storage->getTags($key)); + } }