diff --git a/src/cli/Arguments.php b/src/cli/Arguments.php index 92a9ccf..ee20ecb 100644 --- a/src/cli/Arguments.php +++ b/src/cli/Arguments.php @@ -86,6 +86,11 @@ final class Arguments */ private $text; + /** + * @var bool + */ + private $textSummaryOnly; + /** * @var ?string */ @@ -106,7 +111,12 @@ final class Arguments */ private $pathPrefix; - public function __construct(?string $command, ?string $script, ?string $directory, ?string $coverage, ?string $patch, ?string $configuration, array $include, bool $pathCoverage, bool $addUncovered, bool $processUncovered, ?string $clover, ?string $cobertura, ?string $crap4j, ?string $html, ?string $php, ?string $text, ?string $xml, ?string $pathPrefix, bool $help, bool $version) + /** + * @var ?string + */ + private $cobertura; + + public function __construct(?string $command, ?string $script, ?string $directory, ?string $coverage, ?string $patch, ?string $configuration, array $include, bool $pathCoverage, bool $addUncovered, bool $processUncovered, ?string $clover, ?string $cobertura, ?string $crap4j, ?string $html, ?string $php, ?string $text, bool $textSummaryOnly, ?string $xml, ?string $pathPrefix, bool $help, bool $version) { $this->command = $command; $this->script = $script; @@ -124,6 +134,7 @@ public function __construct(?string $command, ?string $script, ?string $director $this->html = $html; $this->php = $php; $this->text = $text; + $this->textSummaryOnly = $textSummaryOnly; $this->xml = $xml; $this->pathPrefix = $pathPrefix; $this->help = $help; @@ -210,6 +221,11 @@ public function text(): ?string return $this->text; } + public function textSummaryOnly(): bool + { + return $this->textSummaryOnly; + } + public function xml(): ?string { return $this->xml; diff --git a/src/cli/ArgumentsBuilder.php b/src/cli/ArgumentsBuilder.php index 6b9f674..8faf7a4 100644 --- a/src/cli/ArgumentsBuilder.php +++ b/src/cli/ArgumentsBuilder.php @@ -29,6 +29,7 @@ final class ArgumentsBuilder 'html=', 'php=', 'text=', + 'summary-only', 'xml=', ], 'arguments' => [ @@ -44,6 +45,7 @@ final class ArgumentsBuilder 'html=', 'php=', 'text=', + 'summary-only', 'xml=', ], 'arguments' => [ @@ -135,6 +137,7 @@ public function build(array $argv): Arguments $html = null; $php = null; $text = null; + $textSummaryOnly = false; $xml = null; $pathPrefix = null; $help = false; @@ -197,6 +200,11 @@ public function build(array $argv): Arguments break; + case '--summary-only': + $textSummaryOnly = true; + + break; + case '--xml': $xml = $option[1]; @@ -238,6 +246,7 @@ public function build(array $argv): Arguments $html, $php, $text, + $textSummaryOnly, $xml, $pathPrefix, $help, diff --git a/src/cli/Command.php b/src/cli/Command.php index 75c6558..280836b 100644 --- a/src/cli/Command.php +++ b/src/cli/Command.php @@ -136,7 +136,7 @@ protected function handleReports(CodeCoverage $coverage, Arguments $arguments): if ($arguments->text()) { print 'Generating code coverage report in text format ... '; - $writer = new TextReport; + $writer = new TextReport(50, 90, false, $arguments->textSummaryOnly()); file_put_contents( $arguments->text(), diff --git a/src/cli/HelpCommand.php b/src/cli/HelpCommand.php index 4e9f92e..a82751f 100644 --- a/src/cli/HelpCommand.php +++ b/src/cli/HelpCommand.php @@ -35,6 +35,7 @@ public function run(Arguments $arguments): int --html Generate code coverage report in HTML format --php Export php-code-coverage object --text Generate code coverage report in text format + --summary-only Output only summary in the text format report --xml Generate code coverage report in PHPUnit XML format Options for "phpcov patch-coverage": diff --git a/tests/end-to-end/help/help.phpt b/tests/end-to-end/help/help.phpt index b75d0ff..5e40e0c 100644 --- a/tests/end-to-end/help/help.phpt +++ b/tests/end-to-end/help/help.phpt @@ -31,6 +31,7 @@ Options common for both "phpcov execute" and "phpcov merge": --html Generate code coverage report in HTML format --php Export php-code-coverage object --text Generate code coverage report in text format + --summary-only Output only summary in the text format report --xml Generate code coverage report in PHPUnit XML format Options for "phpcov patch-coverage": diff --git a/tests/end-to-end/help/help2.phpt b/tests/end-to-end/help/help2.phpt index 9aacddc..5d6b31a 100644 --- a/tests/end-to-end/help/help2.phpt +++ b/tests/end-to-end/help/help2.phpt @@ -33,6 +33,7 @@ Options common for both "phpcov execute" and "phpcov merge": --html Generate code coverage report in HTML format --php Export php-code-coverage object --text Generate code coverage report in text format + --summary-only Output only summary in the text format report --xml Generate code coverage report in PHPUnit XML format Options for "phpcov patch-coverage":