/** * @param Event $event */ public function __invoke(Event $event) { /** @var CommandDefinition $command */ $command = $event->getParameter('command'); if (!in_array($command->getName(), ['verify', 'run'])) { return; } $currentExercise = $this->exerciseRepository->findByName($this->userState->getCurrentExercise()); $this->runnerManager->configureInput($currentExercise, $command); }
public function testExceptionIsThrownWhenConfiguringInputIfNoFactorySupportsExercise() { $exercise = new CliExerciseImpl(); $manager = new RunnerManager(); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Exercise Type: "CLI" not supported'); $manager->configureInput($exercise, new CommandDefinition('my-command', [], 'var_dump')); }