/** * @throws CommandHandlerAlreadyExistsException */ private function readAnnotatedCommandHandlers() { /* @var $this CommandHandler|AnnotatedCommandHandler */ $reader = new CommandHandlerAnnotationReader($this); /* @var $annotation \Apha\Annotations\Annotation\CommandHandler */ foreach ($reader->readAll() as $annotation) { if (!empty($this->annotatedCommandHandlers[$annotation->getCommandType()])) { throw new CommandHandlerAlreadyExistsException($annotation->getCommandType()); } $this->annotatedCommandHandlers[$annotation->getCommandType()] = $annotation->getMethodName(); } }
/** * @test * @expectedException \Apha\Annotations\AnnotationReaderException */ public function readAllThrowsExceptionIfNoParameterToPass() { $handler = new CommandHandlerAnnotationReaderTest_CommandHandlerWithoutParameter(); $reader = new CommandHandlerAnnotationReader($handler); $reader->readAll(); }