On Sat, 20 Mar 2010, Andres Riancho wrote:
> Never returns 1. In this case it will return 3/8. (there are other
> extra issues here like xdebug not counting lines 1, 2 and 3, but I can
> solve that by using PHP's prepend_file and append_file).
The best way is too enable two options to xdebug_start_code_coverage,
like:
xdebug_start_code_coverage( XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE );
this gives an overview of all lines where PHP thinks there is code. This
only works if the file in which the code runs has *not* been executed
yet. You'll have to put the code in an include file, something like the
test case here:
http://svn.xdebug.org/cgi-bin/viewvc.cgi/xdebug/trunk/tests/bug00515.phpt?view=markup&revision=2899&root=xdebug
(which includes:
<?php
declare(ticks=1);
class UncoveredLine
{
private $_foo;
function __construct($foo)
{
if ($foo === 'bar') {
$this->_foo = $foo;
} else {
$this->_foo = null;
}
}
function getFoo()
{
return $this->_foo;
}
}
?>
Also see:
http://xdebug.org/docs/code_coverage#xdebug_start_code_coverage
with kind regards,
Derick
-- Like Xdebug? Consider a donation: http://xdebug.org/donate.php Xdebug | http://xdebug.org | xdebug-general@lists.xdebug.org twitter: @derickr and @xdebugReceived on Sat Mar 20 2010 - 23:12:24 GMT
This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST