X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/6a7e0d652b1d40a397e1c1386d500101796676c4..62e2da1f937882bf55363b0f10d8625200850642:/test/bdd/steps/cgi-with-coverage.php?ds=sidebyside diff --git a/test/bdd/steps/cgi-with-coverage.php b/test/bdd/steps/cgi-with-coverage.php index 6f0d79bb..dbd8993b 100644 --- a/test/bdd/steps/cgi-with-coverage.php +++ b/test/bdd/steps/cgi-with-coverage.php @@ -1,4 +1,12 @@ addDirectoryToWhitelist($_SERVER['COV_PHP_DIR'].'/lib-php'); -$covfilter->addDirectoryToWhitelist($_SERVER['COV_PHP_DIR'].'/website'); -$coverage = new SebastianBergmann\CodeCoverage\CodeCoverage(null, $covfilter); +if (method_exists($covfilter, 'addDirectoryToWhitelist')) { + // pre PHPUnit 9 + $covfilter->addDirectoryToWhitelist($_SERVER['COV_PHP_DIR'].'/lib-php'); + $covfilter->addDirectoryToWhitelist($_SERVER['COV_PHP_DIR'].'/website'); + $coverage = new SebastianBergmann\CodeCoverage\CodeCoverage(null, $covfilter); +} else { + // since PHP Uit 9 + $covfilter->includeDirectory($_SERVER['COV_PHP_DIR'].'/lib-php'); + $covfilter->includeDirectory($_SERVER['COV_PHP_DIR'].'/website'); + $coverage = new SebastianBergmann\CodeCoverage\CodeCoverage( + (new SebastianBergmann\CodeCoverage\Driver\Selector)->forLineCoverage($covfilter), + $covfilter + ); +} + $coverage->start($_SERVER['COV_TEST_NAME']); register_shutdown_function('coverage_shutdown', $coverage);