3 * SPDX-License-Identifier: GPL-2.0-only
5 * This file is part of Nominatim. (https://nominatim.org)
7 * Copyright (C) 2022 by the Nominatim developer community.
8 * For a full list of authors see the git log.
10 require_once 'SebastianBergmann/CodeCoverage/autoload.php';
13 function coverage_shutdown($oCoverage)
16 $writer = new \SebastianBergmann\CodeCoverage\Report\PHP;
17 $writer->process($oCoverage, $_SERVER['PHP_CODE_COVERAGE_FILE']);
20 $covfilter = new SebastianBergmann\CodeCoverage\Filter();
21 if (method_exists($covfilter, 'addDirectoryToWhitelist')) {
23 $covfilter->addDirectoryToWhitelist($_SERVER['COV_PHP_DIR'].'/lib-php');
24 $covfilter->addDirectoryToWhitelist($_SERVER['COV_PHP_DIR'].'/website');
25 $coverage = new SebastianBergmann\CodeCoverage\CodeCoverage(null, $covfilter);
28 $covfilter->includeDirectory($_SERVER['COV_PHP_DIR'].'/lib-php');
29 $covfilter->includeDirectory($_SERVER['COV_PHP_DIR'].'/website');
30 $coverage = new SebastianBergmann\CodeCoverage\CodeCoverage(
31 (new SebastianBergmann\CodeCoverage\Driver\Selector)->forLineCoverage($covfilter),
36 $coverage->start($_SERVER['COV_TEST_NAME']);
38 register_shutdown_function('coverage_shutdown', $coverage);
40 include $_SERVER['COV_SCRIPT_FILENAME'];