]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/bdd/steps/cgi-with-coverage.php
Ported createCountryNames() to python and added tests
[nominatim.git] / test / bdd / steps / cgi-with-coverage.php
index 17104d47a29b99e437d9597aa2729a9bae08b1a1..6f0d79bb2202bde84de2a1b9e9db79c98a5006c2 100644 (file)
@@ -1,13 +1,20 @@
 <?php
 require_once 'SebastianBergmann/CodeCoverage/autoload.php';
 <?php
 require_once 'SebastianBergmann/CodeCoverage/autoload.php';
+
+
+function coverage_shutdown($oCoverage)
+{
+    $oCoverage->stop();
+    $writer = new \SebastianBergmann\CodeCoverage\Report\PHP;
+    $writer->process($oCoverage, $_SERVER['PHP_CODE_COVERAGE_FILE']);
+}
+
 $covfilter = new SebastianBergmann\CodeCoverage\Filter();
 $covfilter = new SebastianBergmann\CodeCoverage\Filter();
-$covfilter->addDirectoryToWhitelist($_SERVER['COV_PHP_DIR']);
+$covfilter->addDirectoryToWhitelist($_SERVER['COV_PHP_DIR'].'/lib-php');
+$covfilter->addDirectoryToWhitelist($_SERVER['COV_PHP_DIR'].'/website');
 $coverage = new SebastianBergmann\CodeCoverage\CodeCoverage(null, $covfilter);
 $coverage->start($_SERVER['COV_TEST_NAME']);
 
 $coverage = new SebastianBergmann\CodeCoverage\CodeCoverage(null, $covfilter);
 $coverage->start($_SERVER['COV_TEST_NAME']);
 
-include $_SERVER['COV_SCRIPT_FILENAME'];
-
+register_shutdown_function('coverage_shutdown', $coverage);
 
 
-$coverage->stop();
-$writer = new \SebastianBergmann\CodeCoverage\Report\PHP;
-$writer->process($coverage, $_SERVER['PHP_CODE_COVERAGE_FILE']);
+include $_SERVER['COV_SCRIPT_FILENAME'];