Skip to content

Commit

Permalink
Implement --only-summary-for-coverage-text and --show-uncovered-for-c…
Browse files Browse the repository at this point in the history
…overage-text CLI options
  • Loading branch information
sebastianbergmann committed Jul 7, 2024
1 parent 831bf82 commit 80e6b25
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 250 deletions.
16 changes: 13 additions & 3 deletions src/TextUI/Configuration/Cli/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ final class Builder
'coverage-html=',
'coverage-php=',
'coverage-text==',
'only-summary-for-coverage-text',
'show-uncovered-for-coverage-text',
'coverage-xml=',
'path-coverage',
'disallow-test-output',
Expand Down Expand Up @@ -339,9 +341,17 @@ public function fromParameters(array $parameters): Configuration
$option[1] = 'php://stdout';
}

$coverageText = $option[1];
$coverageTextShowUncoveredFiles = false;
$coverageTextShowOnlySummary = false;
$coverageText = $option[1];

break;

case '--only-summary-for-coverage-text':
$coverageTextShowOnlySummary = true;

break;

case '--show-uncovered-for-coverage-text':
$coverageTextShowUncoveredFiles = true;

break;

Expand Down
8 changes: 8 additions & 0 deletions src/TextUI/Configuration/Merger.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@ public function merge(CliConfiguration $cliConfiguration, XmlConfiguration $xmlC
$coverageTextShowOnlySummary = $xmlConfiguration->codeCoverage()->text()->showOnlySummary();
}

if ($cliConfiguration->hasCoverageTextShowUncoveredFiles()) {
$coverageTextShowUncoveredFiles = $cliConfiguration->coverageTextShowUncoveredFiles();
}

if ($cliConfiguration->hasCoverageTextShowOnlySummary()) {
$coverageTextShowOnlySummary = $cliConfiguration->coverageTextShowOnlySummary();
}

if ($cliConfiguration->hasCoverageText()) {
$coverageText = $cliConfiguration->coverageText();
} elseif ($coverageFromXmlConfiguration && $xmlConfiguration->codeCoverage()->hasText()) {
Expand Down
2 changes: 2 additions & 0 deletions src/TextUI/Help.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ private function elements(): array
['arg' => '--coverage-html <dir>', 'desc' => 'Write code coverage report in HTML format to directory'],
['arg' => '--coverage-php <file>', 'desc' => 'Write serialized code coverage data to file'],
['arg' => '--coverage-text=<file>', 'desc' => 'Write code coverage report in text format to file [default: standard output]'],
['arg' => '--only-summary-for-coverage-text', 'desc' => 'Option for code coverage report in text format: only show summary'],
['arg' => '--show-uncovered-for-coverage-text', 'desc' => 'Option for code coverage report in text format: show uncovered files'],
['arg' => '--coverage-xml <dir>', 'desc' => 'Write code coverage report in XML format to directory'],
['arg' => '--warm-coverage-cache', 'desc' => 'Warm static analysis cache'],
['arg' => '--coverage-filter <dir>', 'desc' => 'Include <dir> in code coverage reporting'],
Expand Down
Loading

0 comments on commit 80e6b25

Please sign in to comment.