PHPCoverage Code
Status: Beta
Brought to you by:
pnimish
--- a/samples/remote/codeCoverageMain.php +++ b/samples/remote/codeCoverageMain.php @@ -17,9 +17,23 @@ } $web_url = "http://localhost/coverage/"; $cov_url = $web_url . "phpcoverage.remote.top.inc.php"; + // Session 1 file_get_contents($cov_url . "?phpcoverage-action=init&cov-file-name=". urlencode("phpcoverage.data.xml") . "&tmp-dir=". urlencode("/tmp")); + $str = file_get_contents($web_url . "sample.php"); + file_put_contents("/tmp/data1.xml", file_get_contents($cov_url . "?phpcoverage-action=get-coverage-xml")); + file_get_contents($cov_url . "?phpcoverage-action=cleanup"); - file_get_contents($web_url . "sample.php"); + // Session 2 + file_get_contents($cov_url . "?phpcoverage-action=init&cov-file-name=". urlencode("phpcoverage.data2.xml") . "&tmp-dir=". urlencode("/tmp")); + $str = file_get_contents($web_url . "sample2.php"); + file_put_contents("/tmp/data2.xml", file_get_contents($cov_url . "?phpcoverage-action=get-coverage-xml")); + file_get_contents($cov_url . "?phpcoverage-action=cleanup"); + + // Session 3 + file_get_contents($cov_url . "?phpcoverage-action=init&cov-file-name=". urlencode("phpcoverage.data.xml") . "&tmp-dir=". urlencode("/tmp")); + $str = file_get_contents($web_url . "sample.php"); + file_put_contents("/tmp/data3.xml", file_get_contents($cov_url . "?phpcoverage-action=get-coverage-xml")); + file_get_contents($cov_url . "?phpcoverage-action=cleanup"); // Configure reporter, and generate report $covReporter = new HtmlCoverageReporter( @@ -32,9 +46,10 @@ // Notice the coverage recorder is of type RemoteCoverageRecorder $cov = new RemoteCoverageRecorder($includePaths, $excludePaths, $covReporter); // Pass the code coverage XML url into the generateReport function - $cov->generateReport($cov_url . "?phpcoverage-action=get-coverage-xml", true); + //$cov->generateReport($cov_url . "?phpcoverage-action=get-coverage-xml", true); + $cov->generateReport(array("/tmp/data1.xml", "/tmp/data2.xml", "/tmp/data3.xml"), true); $covReporter->printTextSummary($PHPCOVERAGE_REPORT_DIR . "/report.txt"); // Clean up - file_get_contents($cov_url . "?phpcoverage-action=cleanup"); + // file_get_contents($cov_url . "?phpcoverage-action=cleanup"); ?>