Code Coverage using PHPunit 3.4.5
Posted: Tue Aug 17, 2010 8:35 am
Hi All,
I am new to php and i am stuck in generating code coverage report for the code base.
I am unsure how to do it programmatically.I am using following code snippet to do the same
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTest(new TestMyAPI('testA'));
$suite->addTest(new TestMyAPI('testB'));
$suite->addTest(new TestMyAPI('testC'));
$suite->addTest(new TestMyAPI('testD'));
$result = PHPUnit_TextUI_TestRunner::run($suite);
//$sutData = $result->getCodeCoverageInformation();
//$sutFiles = PHPUnit_Util_CodeCoverage::getSummary($sutData, TRUE);
//var_dump( $sutFiles );
But somehow $result->getCodeCoverageInformation(); results in a null array.Somebody plz help me to resolve this.
I am new to php and i am stuck in generating code coverage report for the code base.
I am unsure how to do it programmatically.I am using following code snippet to do the same
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTest(new TestMyAPI('testA'));
$suite->addTest(new TestMyAPI('testB'));
$suite->addTest(new TestMyAPI('testC'));
$suite->addTest(new TestMyAPI('testD'));
$result = PHPUnit_TextUI_TestRunner::run($suite);
//$sutData = $result->getCodeCoverageInformation();
//$sutFiles = PHPUnit_Util_CodeCoverage::getSummary($sutData, TRUE);
//var_dump( $sutFiles );
But somehow $result->getCodeCoverageInformation(); results in a null array.Somebody plz help me to resolve this.