Exemplo n.º 1
0
 public function testExtends()
 {
     $this->if($asserter = new sut($generator = new asserter\generator()))->then->exception(function () use($asserter) {
         $asserter->extends(uniqid());
     })->isInstanceOf('logicException')->hasMessage('Class is undefined')->if($class = uniqid())->and($parentClass = uniqid())->and($mockController = new atoum\mock\controller())->and($mockController->__construct = function () {
     })->and($mockController->getName = function () use($class) {
         return $class;
     })->and($asserter->setReflectionClassInjector(function ($class) use($mockController) {
         return new \mock\reflectionClass($class, $mockController);
     })->setWith($class))->and($mockController->isSubclassOf = false)->then->exception(function () use($asserter, $parentClass) {
         $asserter->extends($parentClass);
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('Class %s is not a sub-class of %s'), $class, $parentClass))->if($mockController->isSubclassOf = true)->then->object($asserter->extends($parentClass))->isIdenticalTo($asserter);
 }