예제 #1
1
파일: Run.php 프로젝트: BatVane/Codeception
 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);
         }
     }
 }