hasCode() public method

public hasCode ( $code, $failMessage = null )
示例#1
0
 public function testHasCode()
 {
     $this->if($asserter = new sut($generator = new asserter\generator()))->then->boolean($asserter->wasSet())->isFalse()->exception(function () use($asserter) {
         $asserter->hasCode(rand(-PHP_INT_MAX, PHP_INT_MAX));
     })->isInstanceOf('logicException')->hasMessage('Exception is undefined')->if($asserter->setWith(new atoum\exceptions\runtime(uniqid(), $code = rand(2, PHP_INT_MAX))))->then->exception(function () use($asserter, &$otherCode) {
         $asserter->hasCode($otherCode = 1);
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('code is %d instead of %d'), $code, $otherCode))->object($asserter->hasCode($code))->isIdenticalTo($asserter);
 }