Ticket #263 (closed defect: fixed)

Opened 5 months ago

Last modified 2 months ago

phpunit code coverage file format change

Reported by: duke@masendav.com Assigned to: hans
Priority: major Milestone: 2.4.0
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

10/07/08 20:13:04 changed by city

may this help?

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

if (!is_array($right))
  $right = PHPUnit_Util_CodeCoverage::bitStringToCodeCoverage(array($right), array(1));

10/21/08 13:16:59 changed by hans

(In [411]) Refs #263 - Applying (untested) proposed fix for code coverage

10/21/08 13:17:19 changed by hans

I've applied the proposed fix in r411; Please let me know if this solves the issue.

10/22/08 16:42:18 changed by olivier@phppro.fr

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).

10/22/08 17:54:19 changed by duke@masendav.com

Nice to know it got fixed :)

I myself switched over to code coverage report generated by PHPUnit ifself.

10/22/08 19:01:02 changed by hans

(In [412]) Refs #263 - Applying corrected fix proposed by olivier

10/22/08 19:01:03 changed by hans

(In [412]) Refs #263 - Applying corrected fix proposed by olivier

10/22/08 19:01:30 changed by hans

Ok -- I applied that corrected version in r412. If that seems to work for all, then I'll call this resolved.

10/28/08 19:18:14 changed by mrook

(In [424]) Refs #263 - upstream merge of fix

10/28/08 19:32:12 changed by mrook

  • status changed from new to closed.
  • resolution set to fixed.

Confirmed to work.


Add/Change #263 (phpunit code coverage file format change)




Action