Ticket #263 (closed defect: fixed)
phpunit code coverage file format change
| Reported by: | duke@… | Owned by: | hans |
|---|---|---|---|
| Priority: | major | Milestone: | 2.4.0RC1 |
| Component: | phing-tasks-ext | Version: | 2.3.0 |
| Keywords: | Cc: |
Description
While playing with Phing and PHPUnit 3.3beta1 I found out that the coverage file format has been changed, thus all CoverageMerge logic in Phing breaks in many interesting ways.
Before PHPUnit 3.3beta1 the generation code looked like this: http://www.phpunit.de/browser/phpunit/branches/release/3.3/PHPUnit/Framework/TestResult.php?rev=2540#L487
Now it looks like this: http://www.phpunit.de/browser/phpunit/branches/release/3.3/PHPUnit/Framework/TestResult.php?rev=2541#L487
note the codeCoverageToBitString method.
Not sure what the correct way to resolve this is? Maybe call phpunit code to decypher the file? That would protect phing from further file format changes.
Attachments
Change History
comment:3 Changed 23 months ago by hans
I've applied the proposed fix in r411; Please let me know if this solves the issue.
comment:4 Changed 23 months ago by olivier@…
It seems there still be an error in your fix because I have 0% in "methods" metric (at least when I execute it on my PHPUnit 3.3.1 and Phing 2.3.0 using PHP 5.2.6 with Xdebug v2.1.0-dev on Windows XP)
I modified your fix with this line :
$right = array_shift(PHPUnit_Util_CodeCoverage::bitStringToCodeCoverage(array($right), 1));
(instead of yours :
$right = PHPUnit_Util_CodeCoverage::bitStringToCodeCoverage(array($right), array(1));
)
and it seems to works for me (I have my code coverage).
comment:5 Changed 23 months ago by duke@…
Nice to know it got fixed :)
I myself switched over to code coverage report generated by PHPUnit ifself.
comment:8 Changed 23 months ago by hans
Ok -- I applied that corrected version in r412. If that seems to work for all, then I'll call this resolved.
comment:10 Changed 22 months ago by mrook
- Status changed from new to closed
- Resolution set to fixed
Confirmed to work.

may this help?
file: pear/phing/tasks/ext/coverage/CoverageMerger.php
function: merge($project, $codeCoverageInformation)
line: 115