isInstanceOf() public method

public isInstanceOf ( $value, $failMessage = null )
Example #1
0
 public function testIsInstanceOf()
 {
     $this->if($asserter = new sut($generator = new asserter\generator()))->then->exception(function () use($asserter) {
         $asserter->hasSize(rand(0, PHP_INT_MAX));
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Exception is undefined')->if($asserter->setWith(new \exception()))->then->object($asserter->isInstanceOf('\\Exception'))->isIdenticalTo($asserter)->object($asserter->isInstanceOf('Exception'))->isIdenticalTo($asserter)->object($asserter->isInstanceOf('\\exception'))->isIdenticalTo($asserter)->object($asserter->isInstanceOf('exception'))->isIdenticalTo($asserter)->exception(function () use($asserter) {
         $asserter->isInstanceOf(uniqid());
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic\\invalidArgument')->hasMessage('Argument of mageekguy\\atoum\\asserters\\exception::isInstanceOf() must be a \\exception instance or an exception class name')->exception(function () use($asserter) {
         $asserter->isInstanceOf('mageekguy\\atoum\\exceptions\\runtime');
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s is not an instance of mageekguy\\atoum\\exceptions\\runtime'), $asserter));
 }