From a2d21657d3f9b4d35a47772acec17fc627634528 Mon Sep 17 00:00:00 2001 From: Jarek Tkaczyk Date: Wed, 11 Jul 2018 22:33:41 +0800 Subject: [PATCH] support variadic tags params called on Repository --- src/Illuminate/Cache/Repository.php | 2 +- tests/Cache/CacheRepositoryTest.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Cache/Repository.php b/src/Illuminate/Cache/Repository.php index de06b9ca9c54..16319a09a9ae 100755 --- a/src/Illuminate/Cache/Repository.php +++ b/src/Illuminate/Cache/Repository.php @@ -419,7 +419,7 @@ public function tags($names) throw new BadMethodCallException('This cache store does not support tagging.'); } - $cache = $this->store->tags($names); + $cache = $this->store->tags(is_array($names) ? $names : func_get_args()); if (! is_null($this->events)) { $cache->setEventDispatcher($this->events); diff --git a/tests/Cache/CacheRepositoryTest.php b/tests/Cache/CacheRepositoryTest.php index f35a20edbb59..f91980120eae 100755 --- a/tests/Cache/CacheRepositoryTest.php +++ b/tests/Cache/CacheRepositoryTest.php @@ -228,6 +228,17 @@ public function testRemovingMultipleKeys() $repo->deleteMultiple(['a-key', 'a-second-key']); } + public function testAllTagsArePassedToTaggableStore() + { + $store = m::mock('Illuminate\Cache\ArrayStore'); + $repo = new \Illuminate\Cache\Repository($store); + + $taggedCache = m::mock(); + $taggedCache->shouldReceive('setDefaultCacheTime'); + $store->shouldReceive('tags')->once()->with(['foo', 'bar', 'baz'])->andReturn($taggedCache); + $repo->tags('foo', 'bar', 'baz'); + } + protected function getRepository() { $dispatcher = new \Illuminate\Events\Dispatcher(m::mock('Illuminate\Container\Container'));