Ticket #263 (closed defect: fixed)

Opened 19 months ago

Last modified 12 months ago

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

Changed 17 months ago 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));

Changed 17 months ago by hans

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

Changed 17 months ago by hans

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

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

Changed 17 months ago by duke@…

Nice to know it got fixed :)

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

Changed 17 months ago by hans

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

Changed 17 months ago by hans

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

Changed 17 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.

Changed 17 months ago by mrook

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

Changed 17 months ago by mrook

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

Confirmed to work.

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

Author


E-mail address and user name can be saved in the Preferences.


Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.