[FIX] Uge session of debugging and code coverage.

This commit is contained in:
NADAL Jean-Baptiste
2026-09-14 17:22:18 +02:00
parent e79c865f8c
commit a38fc0bfa9
35 changed files with 2315 additions and 1092 deletions
+25
View File
@@ -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));
});