[FIX] Uge session of debugging and code coverage.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// Dev-only: prepend file that enables Xdebug code coverage on the PHP
|
||||
// built-in server. Loaded via -d auto_prepend_file=... during coverage runs.
|
||||
// Not shipped in the deploy archive (see deploy/deploy.sh).
|
||||
|
||||
if (!function_exists('xdebug_start_code_coverage')) {
|
||||
return;
|
||||
}
|
||||
|
||||
xdebug_set_filter(XDEBUG_FILTER_CODE_COVERAGE, XDEBUG_PATH_INCLUDE, [
|
||||
realpath(__DIR__ . '/index.php'),
|
||||
realpath(__DIR__ . '/router.php'),
|
||||
realpath(__DIR__ . '/lib'),
|
||||
]);
|
||||
|
||||
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
|
||||
|
||||
register_shutdown_function(function () {
|
||||
$cov = xdebug_get_code_coverage();
|
||||
$dir = sys_get_temp_dir() . '/ohmj_cov';
|
||||
if (!is_dir($dir)) {
|
||||
@mkdir($dir, 0777, true);
|
||||
}
|
||||
@file_put_contents($dir . '/cov_' . getmypid() . '_' . uniqid('', true) . '.ser', serialize($cov));
|
||||
});
|
||||
Reference in New Issue
Block a user