diff --git a/src/PhpunitMerger/Command/CoverageCommand.php b/src/PhpunitMerger/Command/CoverageCommand.php index a87ad4f..c69aab8 100644 --- a/src/PhpunitMerger/Command/CoverageCommand.php +++ b/src/PhpunitMerger/Command/CoverageCommand.php @@ -60,7 +60,7 @@ protected function configure() ->addOption( 'coverage-cache', null, - InputArgument::OPTIONAL, + InputOption::VALUE_OPTIONAL, 'The cache directory to be used for the code coverage' ); } @@ -71,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $finder->files() ->in(realpath($input->getArgument('directory'))); - $codeCoverage = $this->getCodeCoverage($input->getArgument('coverage-cache')); + $codeCoverage = $this->getCodeCoverage($output, $input->getOption('coverage-cache')); foreach ($finder as $file) { $coverage = require $file->getRealPath(); @@ -81,7 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $codeCoverage->merge($coverage); } - $this->writeCodeCoverage($codeCoverage, $output, $input->getArgument('file'), $input->getOption('cobertura') ?? false); + $this->writeCodeCoverage($codeCoverage,$output, $input->getArgument('file'), $input->getOption('cobertura') ?? false); $html = $input->getOption('html'); if ($html !== null) { $lowUpperBound = (int)($input->getOption('lowUpperBound') ?: 50); @@ -92,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - private function getCodeCoverage($coverageCache = null) + private function getCodeCoverage(OutputInterface $output, $coverageCache = null) { $driver = null; $filter = null; @@ -104,6 +104,7 @@ private function getCodeCoverage($coverageCache = null) $codeCoverage = new CodeCoverage($driver, $filter); if ($coverageCache) { + $output->writeln('Using directory ' . $coverageCache . ' as coverage cache...'); $codeCoverage->cacheStaticAnalysis($coverageCache); }