示例#1
1
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $options = $input->getOptions();
     if ($input->getArgument('test')) {
         $options['steps'] = true;
     }
     $suite = $input->getArgument('suite');
     $test = $input->getArgument('test');
     $codecept = new \Codeception\Codecept((array) $options);
     $suites = $suite ? array($suite) : \Codeception\Configuration::suites();
     $output->writeln(\Codeception\Codecept::versionString() . "\nPowered by " . \PHPUnit_Runner_Version::getVersionString());
     if ($suite and $test) {
         $codecept->runSuite($suite, $test);
     }
     if (!$test) {
         foreach ($suites as $suite) {
             $codecept->runSuite($suite);
         }
     }
     $codecept->printResult();
     if (!$input->getOption('no-exit')) {
         if ($codecept->getResult()->failureCount() or $codecept->getResult()->errorCount()) {
             exit(1);
         }
     }
 }
示例#2
0
文件: Run.php 项目: pfz/codeception
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln(\Codeception\Codecept::versionString() . "\nPowered by " . \PHPUnit_Runner_Version::getVersionString());
     $options = $input->getOptions();
     if ($options['group']) {
         $output->writeln(sprintf("[Groups] <info>%s</info> ", implode(', ', $options['group'])));
     }
     if ($input->getArgument('test') && strtolower(substr($input->getArgument('test'), -4)) === '.php') {
         $options['steps'] = true;
     }
     if ($input->getOption('debug')) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     }
     $suite = $input->getArgument('suite');
     $test = $input->getArgument('test');
     $codecept = new \Codeception\Codecept((array) $options);
     $config = \Codeception\Configuration::config();
     if (strpos($suite, $config['paths']['tests']) === 0) {
         $matches = $this->matchTestFromFilename($suite, $config['paths']['tests']);
         $suite = $matches[1];
         $test = $matches[2];
     }
     $suites = $suite ? array($suite) : \Codeception\Configuration::suites();
     if ($suite and $test) {
         $codecept->runSuite($suite, $test);
     }
     if (!$test) {
         foreach ($suites as $suite) {
             $codecept->runSuite($suite);
         }
     }
     $codecept->printResult();
     if (!$input->getOption('no-exit')) {
         if ($codecept->getResult()->failureCount() or $codecept->getResult()->errorCount()) {
             exit(1);
         }
     }
 }