2017-07-17 23:59:13 +03:00
|
|
|
<?php
|
2022-01-03 18:23:58 +03:00
|
|
|
/**
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
*
|
|
|
|
* This file is part of Nominatim. (https://nominatim.org)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2022 by the Nominatim developer community.
|
|
|
|
* For a full list of authors see the git log.
|
|
|
|
*/
|
2017-07-17 23:59:13 +03:00
|
|
|
require_once 'SebastianBergmann/CodeCoverage/autoload.php';
|
2017-09-19 23:42:09 +03:00
|
|
|
|
2018-02-23 03:16:01 +03:00
|
|
|
|
2017-09-19 23:42:09 +03:00
|
|
|
function coverage_shutdown($oCoverage)
|
|
|
|
{
|
|
|
|
$oCoverage->stop();
|
|
|
|
$writer = new \SebastianBergmann\CodeCoverage\Report\PHP;
|
|
|
|
$writer->process($oCoverage, $_SERVER['PHP_CODE_COVERAGE_FILE']);
|
|
|
|
}
|
|
|
|
|
2017-07-17 23:59:13 +03:00
|
|
|
$covfilter = new SebastianBergmann\CodeCoverage\Filter();
|
2021-12-07 14:07:17 +03:00
|
|
|
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
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-07-17 23:59:13 +03:00
|
|
|
$coverage->start($_SERVER['COV_TEST_NAME']);
|
|
|
|
|
2017-09-19 23:42:09 +03:00
|
|
|
register_shutdown_function('coverage_shutdown', $coverage);
|
|
|
|
|
2017-07-17 23:59:13 +03:00
|
|
|
include $_SERVER['COV_SCRIPT_FILENAME'];
|