Skip to content

Commit

Permalink
Merge branch '5.5' of github.com:laravel/framework into 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 20, 2019
2 parents 47483c0 + 87d64cd commit e3e8d58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Cache/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function put($key, $value, $minutes = null)
*/
public function set($key, $value, $ttl = null)
{
$this->put($key, $value, $ttl);
$this->put($key, $value, is_int($ttl) ? $ttl / 60 : null);
}

/**
Expand All @@ -225,7 +225,7 @@ public function putMany(array $values, $minutes)
*/
public function setMultiple($values, $ttl = null)
{
$this->putMany(is_array($values) ? $values : iterator_to_array($values), $ttl);
$this->putMany(is_array($values) ? $values : iterator_to_array($values), is_int($ttl) ? $ttl / 60 : null);
}

/**
Expand Down
8 changes: 3 additions & 5 deletions tests/Cache/CacheRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,16 @@ public function testPuttingMultipleItemsInCache()

public function testSettingMultipleItemsInCacheArray()
{
// Alias of PuttingMultiple
$repo = $this->getRepository();
$repo->getStore()->shouldReceive('putMany')->once()->with(['foo' => 'bar', 'bar' => 'baz'], 1);
$repo->setMultiple(['foo' => 'bar', 'bar' => 'baz'], 1);
$repo->setMultiple(['foo' => 'bar', 'bar' => 'baz'], 60);
}

public function testSettingMultipleItemsInCacheIterator()
{
// Alias of PuttingMultiple
$repo = $this->getRepository();
$repo->getStore()->shouldReceive('putMany')->once()->with(['foo' => 'bar', 'bar' => 'baz'], 1);
$repo->setMultiple(new ArrayIterator(['foo' => 'bar', 'bar' => 'baz']), 1);
$repo->setMultiple(new ArrayIterator(['foo' => 'bar', 'bar' => 'baz']), 60);
}

public function testPutWithDatetimeInPastOrZeroSecondsDoesntSaveItem()
Expand Down Expand Up @@ -210,7 +208,7 @@ public function testSettingCache()
{
$repo = $this->getRepository();
$repo->getStore()->shouldReceive('put')->with($key = 'foo', $value = 'bar', 1);
$repo->set($key, $value, 1);
$repo->set($key, $value, 60);
}

public function testClearingWholeCache()
Expand Down

0 comments on commit e3e8d58

Please sign in to comment.