diff --git a/src/LinusShops/Prophet/Commands/Scry.php b/src/LinusShops/Prophet/Commands/Scry.php index a90fc3a..4867a57 100644 --- a/src/LinusShops/Prophet/Commands/Scry.php +++ b/src/LinusShops/Prophet/Commands/Scry.php @@ -68,6 +68,12 @@ protected function configure() InputOption::VALUE_NONE, 'If set, will display code coverage report' ) + ->addOption( + 'filter', + 'f', + InputOption::VALUE_OPTIONAL, + 'Filter test methods by a regular expression' + ) ; } @@ -91,6 +97,9 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($input->getOption('coverage')) { $cmd .= ' --coverage'; } + if ($input->getOption('filter')) { + $cmd .= ' --filter '.$input->getOption('filter'); + } $this->cli->veryVerbose($cmd, $output); passthru($cmd); } else { @@ -173,7 +182,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $runner = new TestRunner(); $runner->run( $path = $input->getOption('path').'/'.$module->getPath(), - $input->getOption('coverage') + $input->getOption('coverage'), + $input->getOption('filter') ); $dispatcher->dispatch(Events::PROPHET_POSTMODULE, new Events\Module($module)); } diff --git a/src/LinusShops/Prophet/TestRunner.php b/src/LinusShops/Prophet/TestRunner.php index fded644..e1e00e2 100644 --- a/src/LinusShops/Prophet/TestRunner.php +++ b/src/LinusShops/Prophet/TestRunner.php @@ -21,7 +21,7 @@ class TestRunner * 1: Tests failed * 2: Failed with exception */ - public function run($modulePath, $coverage = false) + public function run($modulePath, $coverage = false, $filter = false) { $runner = new \PHPUnit_TextUI_Command(); $options = array( @@ -30,6 +30,11 @@ public function run($modulePath, $coverage = false) $modulePath.'/phpunit.xml' ); + if ($filter !== false) { + $options[] = '--filter'; + $options[] = $filter; + } + if ($coverage) { $options[] = '--coverage-text'; }