Hello,
I'm currently developing a code coverage measurement system using Xdebug,
Phing and PHPUnit2,
and I've stumbled on a few peculiarities regarding Xdebug.
My tool currently measures the amount of methods in a set of classes covered
by testcases, and I
would like to expand this to statements and conditionals covered (similar to
Clover). However,
whenever if/else if blocks are encountered by Xdebug, the code coverage
report seems incorrect.
The following code is an example:
<?php
function a($b)
{
if ($b == 0)
{
return true;
}
else
if ($b == 1)
{
return false;
}
};
xdebug_start_code_coverage();
a(1);
xdebug_stop_code_coverage();
print_r(xdebug_get_code_coverage());
?>
The output is:
Array
(
[/var/www/experiment/xdebug.php] => Array
(
[4] => 1
[11] => 1
[17] => 2
[19] => 2
)
)
It could very well be a PHP bytecode thing, but imho lines 8 and 9 (the else
/ if ($b == 1) statements)
should be in the code coverage results as well.
Regards,
Michiel Rook
Received on Wed Oct 27 2004 - 13:52:02 BST
This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST