/** * @expectedException \Hansel23\Dictionaries\Exceptions\InvalidKeyException */ public function testAccessingUnsettedItemThrowsException() { $dictionary = new Dictionary(gettype(2), gettype('string')); $dictionary->add(1, 'First'); foreach ($dictionary as $key => $value) { $dictionary->offsetUnset($key); $dictionary->offsetGet($key); } }