/**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     //Registers namespaces for disabled modules.
     $this->test_discovery->registerTestNamespaces();
     $testClass = $input->getOption('test-class');
     $group = $input->getArgument('group');
     if ($testClass) {
         $this->testDetail($io, $testClass);
     } else {
         $this->testList($io, $group);
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     //Registers namespaces for disabled modules.
     $this->test_discovery->registerTestNamespaces();
     $testClass = $input->getArgument('test-class');
     $testMethods = $input->getArgument('test-methods');
     $url = $input->getOption('url');
     if (!$url) {
         $io->error($this->trans('commands.test.run.messages.url-required'));
         return null;
     }
     $this->setEnvironment($url);
     // Create simpletest test id
     $testId = db_insert('simpletest_test_id')->useDefaults(['test_id'])->execute();
     if (is_subclass_of($testClass, 'PHPUnit_Framework_TestCase')) {
         $io->info($this->trans('commands.test.run.messages.phpunit-pending'));
         return null;
     } else {
         if (!class_exists($testClass)) {
             $io->error(sprintf($this->trans('commands.test.run.messages.invalid-class'), $testClass));
             return 1;
         }
         $test = new $testClass($testId);
         $io->info($this->trans('commands.test.run.messages.starting-test'));
         Timer::start('run-tests');
         $test->run($testMethods);
         $end = Timer::stop('run-tests');
         $io->simple($this->trans('commands.test.run.messages.test-duration') . ': ' . $this->dateFormatter->formatInterval($end['time'] / 1000));
         $io->simple($this->trans('commands.test.run.messages.test-pass') . ': ' . $test->results['#pass']);
         $io->commentBlock($this->trans('commands.test.run.messages.test-fail') . ': ' . $test->results['#fail']);
         $io->commentBlock($this->trans('commands.test.run.messages.test-exception') . ': ' . $test->results['#exception']);
         $io->simple($this->trans('commands.test.run.messages.test-debug') . ': ' . $test->results['#debug']);
         $this->moduleHandler->invokeAll('test_finished', [$test->results]);
         $io->newLine();
         $io->info($this->trans('commands.test.run.messages.test-summary'));
         $io->newLine();
         $currentClass = null;
         $currentGroup = null;
         $currentStatus = null;
         $messages = $this->simpletestScriptLoadMessagesByTestIds([$testId]);
         foreach ($messages as $message) {
             if ($currentClass === null || $currentClass != $message->test_class) {
                 $currentClass = $message->test_class;
                 $io->comment($message->test_class);
             }
             if ($currentGroup === null || $currentGroup != $message->message_group) {
                 $currentGroup = $message->message_group;
             }
             if ($currentStatus === null || $currentStatus != $message->status) {
                 $currentStatus = $message->status;
                 if ($message->status == 'fail') {
                     $io->error($this->trans('commands.test.run.messages.group') . ':' . $message->message_group . ' ' . $this->trans('commands.test.run.messages.status') . ':' . $message->status);
                     $io->newLine();
                 } else {
                     $io->info($this->trans('commands.test.run.messages.group') . ':' . $message->message_group . ' ' . $this->trans('commands.test.run.messages.status') . ':' . $message->status);
                     $io->newLine();
                 }
             }
             $io->simple($this->trans('commands.test.run.messages.file') . ': ' . str_replace($this->appRoot, '', $message->file));
             $io->simple($this->trans('commands.test.run.messages.method') . ': ' . $message->function);
             $io->simple($this->trans('commands.test.run.messages.line') . ': ' . $message->line);
             $io->simple($this->trans('commands.test.run.messages.message') . ': ' . $message->message);
             $io->newLine();
         }
         return null;
     }
 }