code coverage stuff
This commit is contained in:
parent
6b60b6f58b
commit
bb4085972b
2 changed files with 23 additions and 0 deletions
|
@ -803,4 +803,25 @@ function _end_cache() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
* Code coverage *
|
||||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
function _start_debug() {
|
||||
if(function_exists("xdebug_start_code_coverage")) {
|
||||
#xdebug_start_code_coverage(XDEBUG_CC_UNUSED|XDEBUG_CC_DEAD_CODE);
|
||||
xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
|
||||
}
|
||||
}
|
||||
|
||||
function _end_debug() {
|
||||
if(function_exists("xdebug_get_code_coverage")) {
|
||||
if(!file_exists("data/coverage")) mkdir("data/coverage");
|
||||
$n = 0;
|
||||
$t = time();
|
||||
while(file_exists("data/coverage/$t.$n.log")) $n++;
|
||||
file_put_contents("data/coverage/$t.$n.log", serialize(xdebug_get_code_coverage()));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -64,6 +64,7 @@ if(!file_exists("config.php")) {
|
|||
|
||||
require_once "config.php";
|
||||
require_once "core/util.inc.php";
|
||||
if(DEBUG) {_start_debug();}
|
||||
_version_check();
|
||||
_sanitise_environment();
|
||||
_start_cache();
|
||||
|
@ -147,4 +148,5 @@ catch(Exception $e) {
|
|||
</html>
|
||||
EOD;
|
||||
}
|
||||
if(DEBUG) {_end_debug();}
|
||||
?>
|
||||
|
|
Reference in a new issue