]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #1782 from Simon-Will/1781-make-tests-work-with-phpunit-8
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 7 May 2020 20:01:35 +0000 (22:01 +0200)
committerGitHub <noreply@github.com>
Thu, 7 May 2020 20:01:35 +0000 (22:01 +0200)
Make tests work with phpunit 8

docs/admin/Installation.md
test/php/Nominatim/AddressDetailsTest.php
test/php/Nominatim/DebugTest.php
test/php/Nominatim/LibTest.php
test/php/Nominatim/SearchContextTest.php
test/php/Nominatim/TokenListTest.php
vagrant/Install-on-Ubuntu-18.sh

index 765b2716f275e8f8a3eeb062d44ca05d6d4ef78b..25b4f14ce1d8ea9f288e2dc5d42752822262c568 100644 (file)
@@ -57,7 +57,7 @@ For running tests:
 
   * [behave](http://pythonhosted.org/behave/)
   * [nose](https://nose.readthedocs.io)
-  * [phpunit](https://phpunit.de)
+  * [phpunit](https://phpunit.de) >= 7.3
 
 ### Hardware
 
index b29d908862346cc1c03f3dd819b410f10b53f66a..e7b3a3f85ab5cd13376e0974fe21348ca2e86e04 100644 (file)
@@ -9,7 +9,7 @@ require_once(CONST_BasePath.'/lib/AddressDetails.php');
 class AddressDetailsTest extends \PHPUnit\Framework\TestCase
 {
 
-    protected function setUp()
+    protected function setUp(): void
     {
         // How the fixture got created
         //
index 7ef1dba336836be7f6f6626a75f36943e6edb472..5d9525acc0beef2e5da54b90541bd90154d08611 100644 (file)
@@ -7,7 +7,7 @@ require_once(CONST_BasePath.'/lib/DebugHtml.php');
 class DebugTest extends \PHPUnit\Framework\TestCase
 {
 
-    protected function setUp()
+    protected function setUp(): void
     {
         $this->oWithDebuginfo = $this->getMockBuilder(\GeococdeMock::class)
                                     ->setMethods(array('debugInfo'))
index 7e8cbcc345dc98f9e3ea022a2cb34b2c9e56f289..28cd9af04896f4f58a8b59c326534c2fbf5f73b1 100644 (file)
@@ -98,8 +98,8 @@ class LibTest extends \PHPUnit\Framework\TestCase
 
         foreach ($aQueries as $sQuery) {
             $aRes = parseLatLon($sQuery);
-            $this->assertEquals(40.446, $aRes[1], 'degrees decimal ' . $sQuery, 0.01);
-            $this->assertEquals(-79.982, $aRes[2], 'degrees decimal ' . $sQuery, 0.01);
+            $this->assertEqualsWithDelta(40.446, $aRes[1], 0.01, 'degrees decimal ' . $sQuery);
+            $this->assertEqualsWithDelta(-79.982, $aRes[2], 0.01, 'degrees decimal ' . $sQuery);
             $this->assertEquals($sQuery, $aRes[0]);
         }
     }
index 166e6433d141d259007cbc5b7e17686149d49faf..2b575a16c31a464a0eb4ec385a45097feb41320b 100644 (file)
@@ -9,7 +9,7 @@ class SearchContextTest extends \PHPUnit\Framework\TestCase
     private $oCtx;
 
 
-    protected function setUp()
+    protected function setUp(): void
     {
         $this->oCtx = new SearchContext();
     }
index d31b219b881ae6a05b4b4a1429ab86d256bd4a75..191a09dceeb6a002a5c6c4103cb0557ad06178a3 100644 (file)
@@ -7,7 +7,7 @@ require_once(CONST_BasePath.'/lib/TokenList.php');
 
 class TokenTest extends \PHPUnit\Framework\TestCase
 {
-    protected function setUp()
+    protected function setUp(): void
     {
         $this->oNormalizer = $this->getMockBuilder(\MockNormalizer::class)
                                   ->setMethods(array('transliterate'))
index 7f4ca32fd06171f9bda2b7b9e12fd9938773ee33..02a1c738158dc66aa6560bb6f553e45946c0dc2a 100755 (executable)
@@ -34,15 +34,18 @@ export DEBIAN_FRONTEND=noninteractive #DOCS:
                             python3-psycopg2 python3-tidylib git
 
 # If you want to run the test suite, you need to install the following
-# additional packages:
-
-    sudo apt-get install -y phpunit php-cgi
+# additional packages including the PHP package manager composer:
 
     pip3 install --user behave nose
 
+    sudo apt-get install -y composer php-cgi php-cli php-mbstring php-xml zip unzip
+
     composer global require "squizlabs/php_codesniffer=*"
     sudo ln -s ~/.config/composer/vendor/bin/phpcs /usr/bin/
 
+    composer global require "phpunit/phpunit=8.*"
+    sudo ln -s ~/.config/composer/vendor/bin/phpunit /usr/bin/
+
 #
 # System Configuration
 # ====================