Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add support for PHP_CodeCoverage_Report_PHP.

  • Loading branch information...
commit 70e0629405405cd5336af046adb865be65df2b47 1 parent 950dcf7
@sebastianbergmann authored
View
8 PHPUnit/TextUI/Command.php
@@ -81,6 +81,7 @@ class PHPUnit_TextUI_Command
'configuration=' => NULL,
'coverage-html=' => NULL,
'coverage-clover=' => NULL,
+ 'coverage-php=' => NULL,
'coverage-text=' => NULL,
'debug' => NULL,
'exclude-group=' => NULL,
@@ -281,6 +282,7 @@ protected function handleArguments(array $argv)
case '--coverage-clover':
case '--coverage-html':
+ case '--coverage-php':
case '--coverage-text': {
if (!extension_loaded('tokenizer')) {
$this->showExtensionNotLoadedMessage(
@@ -309,6 +311,11 @@ protected function handleArguments(array $argv)
}
break;
+ case '--coverage-php': {
+ $this->arguments['coveragePHP'] = $option[1];
+ }
+ break;
+
case '--coverage-text': {
$this->arguments['coverageText'] = $option[1];
$this->arguments['coverageTextShowUncoveredFiles'] = FALSE;
@@ -882,6 +889,7 @@ protected function showHelp()
--coverage-clover <file> Generate code coverage report in Clover XML format.
--coverage-html <dir> Generate code coverage report in HTML format.
+ --coverage-php <file> Serialize PHP_CodeCoverage object to file.
--coverage-text <file> Generate code coverage report in text format.
--testdox-html <file> Write agile documentation in HTML format to file.
View
12 PHPUnit/TextUI/TestRunner.php
@@ -357,6 +357,18 @@ public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
unset($writer);
}
+ if (isset($arguments['coveragePHP'])) {
+ $this->printer->write(
+ "\nSerializing PHP_CodeCoverage object to file, this may take a moment."
+ );
+
+ $writer = new PHP_CodeCoverage_Report_PHP;
+ $writer->process($codeCoverage, $arguments['coveragePHP']);
+
+ $this->printer->write("\n");
+ unset($writer);
+ }
+
if (isset($arguments['coverageText'])) {
$this->printer->write(
"\nGenerating textual code coverage report, this may take a moment."
View
1  Tests/TextUI/help.phpt
@@ -21,6 +21,7 @@ Usage: phpunit [switches] UnitTest [UnitTest.php]
--coverage-clover <file> Generate code coverage report in Clover XML format.
--coverage-html <dir> Generate code coverage report in HTML format.
+ --coverage-php <file> Serialize PHP_CodeCoverage object to file.
--coverage-text <file> Generate code coverage report in text format.
--testdox-html <file> Write agile documentation in HTML format to file.
View
1  Tests/TextUI/help2.phpt
@@ -22,6 +22,7 @@ Usage: phpunit [switches] UnitTest [UnitTest.php]
--coverage-clover <file> Generate code coverage report in Clover XML format.
--coverage-html <dir> Generate code coverage report in HTML format.
+ --coverage-php <file> Serialize PHP_CodeCoverage object to file.
--coverage-text <file> Generate code coverage report in text format.
--testdox-html <file> Write agile documentation in HTML format to file.
Please sign in to comment.
Something went wrong with that request. Please try again.