Skip to content

Commit

Permalink
support variadic tags params called on Repository (#24810)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarektkaczyk authored and taylorotwell committed Jul 11, 2018
1 parent 9a912d6 commit 6f7116e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Cache/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions tests/Cache/CacheRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down

0 comments on commit 6f7116e

Please sign in to comment.