Exemplo n.º 1
0
 public function testImplements()
 {
     $this->if($asserter = new sut($generator = new asserter\generator()))->then->exception(function () use($asserter) {
         $asserter->implements(uniqid());
     })->isInstanceOf('logicException')->hasMessage('Class is undefined')->if($class = uniqid())->and($interface = 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->implementsInterface = false)->then->exception(function () use($asserter, $interface) {
         $asserter->implements($interface);
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('Class %s does not implement interface %s'), $class, $interface))->if($mockController->implementsInterface = true)->then->object($asserter->implements($interface))->isIdenticalTo($asserter);
 }