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.
Code Coverage using PHPunit 3.4.5
Moderator: General Moderators
Re: Code Coverage using PHPunit 3.4.5
Do you have xdebug installed? PHPUnit uses xdebug to get code coverage data.
Re: Code Coverage using PHPunit 3.4.5
I guess XDebug is not installed , but then when i generate it from command line using command phpunit --coverage-html ./report BankAccountTest.php it generates the report and also says using XDebug <version_number>.Its confusing
Re: Code Coverage using PHPunit 3.4.5
Ok Sorry , I am already running the latest version of XDebug