public function testNonStringKey() { $this->expectException(InvalidArgumentException::class); Utility::validateKey(new \stdClass()); }
/** * 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) { foreach ($keys as $key) { Utility::validateKey($key); } foreach ($keys as $key) { $this->_cache->delete($key); } // TODO: Spec is somewhat not clear. What to return if one item could not be deleted? return true; }