Skip to content

Commit

Permalink
Merge pull request #10 from vemaeg/feature/coverage-text
Browse files Browse the repository at this point in the history
--coverage-text ergänzt.
  • Loading branch information
thirsch authored Jan 14, 2024
2 parents 372ae5c + 6b39eab commit 2f4ba8b
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/PhpunitMerger/Command/CoverageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use SebastianBergmann\CodeCoverage\Report\Clover;
use SebastianBergmann\CodeCoverage\Report\Cobertura;
use SebastianBergmann\CodeCoverage\Report\Html\Facade;
use SebastianBergmann\CodeCoverage\Report\Text;
use SebastianBergmann\CodeCoverage\Report\Thresholds;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
Expand Down Expand Up @@ -63,7 +64,14 @@ protected function configure()
null,
InputOption::VALUE_OPTIONAL,
'The cache directory to be used for the code coverage'
);
)
->addOption(
'coverage-text',
null,
InputOption::VALUE_NONE,
'Export text'
)
;
}

protected function execute(InputInterface $input, OutputInterface $output)
Expand All @@ -85,12 +93,24 @@ protected function execute(InputInterface $input, OutputInterface $output)

$this->writeCodeCoverage($codeCoverage,$output, $input->getArgument('file'), $input->getOption('cobertura') ?? false);
$html = $input->getOption('html');
$lowUpperBound = (int)($input->getOption('lowUpperBound') ?: 50);
$highLowerBound = (int)($input->getOption('highLowerBound') ?: 90);

if ($html !== null) {
$lowUpperBound = (int)($input->getOption('lowUpperBound') ?: 50);
$highLowerBound = (int)($input->getOption('highLowerBound') ?: 90);
$this->writeHtmlReport($codeCoverage, $html, $lowUpperBound, $highLowerBound);
}

if ($input->getOption('coverage-text')) {
$textReport = new Text(
Thresholds::from(
$lowUpperBound,
$highLowerBound,
),
showOnlySummary: true,
);
$output->writeln($textReport->process($codeCoverage));
}

return 0;
}

Expand Down

0 comments on commit 2f4ba8b

Please sign in to comment.