/**
  * @test
  */
 public function delegatesRemoveItems()
 {
     $keyValuePairs = [];
     $this->storage->removeItems($keyValuePairs)->willReturn(true);
     $return = $this->cache->removeItems($keyValuePairs);
     $this->assertTrue($return);
 }
 /**
  * Removes multiple items from the pool.
  *
  * @param array $keys
  *   An array of keys that should be removed from the pool.
  * @throws InvalidArgumentException
  *   If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
  *   MUST be thrown.
  *
  * @return bool
  *   True if the items were successfully removed. False if there was an error.
  */
 public function deleteItems(array $keys)
 {
     $this->validateKeys($keys);
     try {
         $notDeleted = $this->storage->removeItems($keys);
     } catch (Exception\InvalidArgumentException $e) {
         throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
     } catch (Exception\ExceptionInterface $e) {
         throw new CacheException($e->getMessage(), $e->getCode(), $e);
     }
     // @todo Is it an "error" if one of the keys does not exist??
     return empty($notDeleted);
 }
Beispiel #3
0
 public function testRemoveItemsReturnsMissingKeys()
 {
     $this->_storage->setItem('key', 'value');
     $this->assertSame(array('missing'), $this->_storage->removeItems(array('key', 'missing')));
 }
 public function removeItems(array $keys)
 {
     return $this->storage->removeItems($keys);
 }