예제 #1
0
 /**
  * @param ExerciseInterface $exercise
  * @param string $fileName
  * @param OutputInterface $output
  * @return bool
  */
 public function run(ExerciseInterface $exercise, $fileName, OutputInterface $output)
 {
     $exercise->configure($this);
     $this->eventDispatcher->dispatch(new Event('run.start', compact('exercise', 'fileName')));
     try {
         $exitStatus = $this->runnerFactory->create($exercise, $this->eventDispatcher)->run($fileName, $output);
     } finally {
         $this->eventDispatcher->dispatch(new Event('run.finish', compact('exercise', 'fileName')));
     }
     return $exitStatus;
 }
 /**
  * Run a student's solution against a specific exercise. Does not invoke checks. Invokes the
  * correct runner for the exercise based on the exercise type. Various events are triggered throughout the process.
  * The output of the solution is written directly to the `OutputInterface` instance.
  *
  * @param ExerciseInterface $exercise The exercise instance.
  * @param Input $input The command line arguments passed to the command.
  * @param OutputInterface $output An output instance capable of writing to stdout.
  * @return bool Whether the solution ran successfully or not.
  */
 public function run(ExerciseInterface $exercise, Input $input, OutputInterface $output)
 {
     $exercise->configure($this);
     $this->eventDispatcher->dispatch(new ExerciseRunnerEvent('run.start', $exercise, $input));
     try {
         $exitStatus = $this->runnerManager->getRunner($exercise)->run($input, $output);
     } finally {
         $this->eventDispatcher->dispatch(new ExerciseRunnerEvent('run.finish', $exercise, $input));
     }
     return $exitStatus;
 }