Le 18/10/13 19:20, Jan Zerebecki a écrit :
> The whole line. This is a limitation of the PHP extension Xdebug. See
> http://phpunit.de/manual/current/en/code-coverage-analysis.html#code-coverage-analysis.edge-cases
>
> Based on my experience, there will also be some false negatives.
And also note that line coverage means that a function claimed as 100%
covered does not necessary has all code paths covered or all contexts.
That is specially true with globals / RequestContext varying.
An example of a function that should print only one message:
/**
* put a single message error.
*/
function oneMessage( $x, $y ) {
$i = 0;
if ( $x ) {
$i++;
}
if ( $y ) {
print "$y has $i";
}
}
You will get full line coverage by testing:
oneError( true, "message"); // prints 'message has 1'
oneError( false, '' ); // prints nothing
But you are not actually covering all the possible code paths:
oneError( false, 'Oh yeah' ); // print 'Oh yeah has 0'
oneError( true, '' ); // prints nothing
It could potentially be done by dumping the PHP code AST and record the
opcodes being traversed by each test, but I am not aware of any tool to
do that (yet?).
cheers,
--
Antoine "hashar" Musso
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l