Skip to content

Commit

Permalink
remove extra call to isValidKey (googleapis#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer authored Sep 13, 2017
1 parent acce35f commit d624df6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/Cache/MemoryCacheItemPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function getItems(array $keys = [])
$items = [];

foreach ($keys as $key) {
$this->isValidKey($key);
$items[$key] = $this->hasItem($key) ? clone $this->items[$key] : new Item($key);
}

Expand Down
34 changes: 33 additions & 1 deletion tests/Cache/MemoryCacheItemPoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,44 @@ public function testCommitsDeferredItems()
* @expectedException \Psr\Cache\InvalidArgumentException
* @dataProvider invalidKeys
*/
public function testCheckInvalidKeys($key)
public function testCheckInvalidKeysOnGetItem($key)
{
$this->pool->getItem($key);
}

/**
* @expectedException \Psr\Cache\InvalidArgumentException
* @dataProvider invalidKeys
*/
public function testCheckInvalidKeysOnGetItems($key)
{
$this->pool->getItems([$key]);
}

/**
* @expectedException \Psr\Cache\InvalidArgumentException
* @dataProvider invalidKeys
*/
public function testCheckInvalidKeysOnHasItem($key)
{
$this->pool->hasItem($key);
}

/**
* @expectedException \Psr\Cache\InvalidArgumentException
* @dataProvider invalidKeys
*/
public function testCheckInvalidKeysOnDeleteItem($key)
{
$this->pool->deleteItem($key);
}

/**
* @expectedException \Psr\Cache\InvalidArgumentException
* @dataProvider invalidKeys
*/
public function testCheckInvalidKeysOnDeleteItems($key)
{
$this->pool->deleteItems([$key]);
}

Expand Down

0 comments on commit d624df6

Please sign in to comment.