atKey() public method

public atKey ( $key, $failMessage = null )
示例#1
0
 public function testAtKey()
 {
     $this->if($asserter = new sut($generator = new asserter\generator()))->then->exception(function () use($asserter) {
         $asserter->atKey(uniqid());
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Array is undefined')->if($asserter->setWith(array(uniqid(), uniqid(), $data = rand(1, PHP_INT_MAX), uniqid(), uniqid())))->object($asserter->atKey(0))->isIdenticalTo($asserter)->object($asserter->atKey('0'))->isIdenticalTo($asserter)->object($asserter->atKey(1))->isIdenticalTo($asserter)->object($asserter->atKey(2))->isIdenticalTo($asserter)->object($asserter->atKey(3))->isIdenticalTo($asserter)->object($asserter->atKey(4))->isIdenticalTo($asserter)->exception(function () use($asserter, &$key) {
         $asserter->atKey($key = rand(5, PHP_INT_MAX));
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s has no key %s'), $asserter, $asserter->getTypeOf($key)))->exception(function () use($asserter, &$key, &$message) {
         $asserter->atKey($key = rand(5, PHP_INT_MAX), $message = uniqid());
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage($message);
 }