XDEBUG EXTENSION FOR PHP | DOCUMENTATION
Code coverage tells you which lines of script (or set of scripts) have been executed during a request. With this information you can for example find out how good your unit tests are.
xdebug.coverage_enableType: boolean, Default value: 1, Introduced in Xdebug >= 2.2
If this setting is set to 0, then Xdebug will not set-up internal structures to allow code coverage. This speeds up Xdebug quite a bit, but of course, Code Coverage Analysis won't work.
Returns whether code coverage is active.
Returns whether code coverage has been started.
Returns code coverage information
Returns a structure which contains information about which lines were executed in your script (including include files). The following example shows code coverage for one specific file:
array '/home/httpd/html/test/xdebug/docs/xdebug_get_code_coverage.php' => array 5 => int 1 6 => int 1 7 => int 1 9 => int 1 10 => int 1 11 => int 1 12 => int 1 13 => int 1 15 => int 1 16 => int 1 18 => int 1
void xdebug_start_code_coverage( [int options] )
Starts code coverage
This function starts gathering the information for code coverage. The information that is collected consists of an two dimensional array with as primary index the executed filename and as secondary key the line number. The value in the elements represents whether the line has been executed or whether it has unreachable lines.
The returned values for each line are:
This function has two options, which act as a bitfield:
You can use the options as shown in the following example.
void xdebug_stop_code_coverage( [int cleanup=true] )
Stops code coverage
This function stops collecting information, the information in memory will be destroyed. If you pass "false" as argument, then the code coverage information will not be destroyed so that you can resume the gathering of information with the xdebug_start_code_coverage() function again.
This site and all of its contents are Copyright © 2002-2015 by Derick Rethans.
All rights reserved.