Merge pull request #1782 from Simon-Will/1781-make-tests-work-with-phpunit-8

Make tests work with phpunit 8
This commit is contained in:
Sarah Hoffmann
2020-05-07 22:01:35 +02:00
committed by GitHub
7 changed files with 13 additions and 10 deletions

View File

@@ -57,7 +57,7 @@ For running tests:
* [behave](http://pythonhosted.org/behave/) * [behave](http://pythonhosted.org/behave/)
* [nose](https://nose.readthedocs.io) * [nose](https://nose.readthedocs.io)
* [phpunit](https://phpunit.de) * [phpunit](https://phpunit.de) >= 7.3
### Hardware ### Hardware

View File

@@ -9,7 +9,7 @@ require_once(CONST_BasePath.'/lib/AddressDetails.php');
class AddressDetailsTest extends \PHPUnit\Framework\TestCase class AddressDetailsTest extends \PHPUnit\Framework\TestCase
{ {
protected function setUp() protected function setUp(): void
{ {
// How the fixture got created // How the fixture got created
// //

View File

@@ -7,7 +7,7 @@ require_once(CONST_BasePath.'/lib/DebugHtml.php');
class DebugTest extends \PHPUnit\Framework\TestCase class DebugTest extends \PHPUnit\Framework\TestCase
{ {
protected function setUp() protected function setUp(): void
{ {
$this->oWithDebuginfo = $this->getMockBuilder(\GeococdeMock::class) $this->oWithDebuginfo = $this->getMockBuilder(\GeococdeMock::class)
->setMethods(array('debugInfo')) ->setMethods(array('debugInfo'))

View File

@@ -98,8 +98,8 @@ class LibTest extends \PHPUnit\Framework\TestCase
foreach ($aQueries as $sQuery) { foreach ($aQueries as $sQuery) {
$aRes = parseLatLon($sQuery); $aRes = parseLatLon($sQuery);
$this->assertEquals(40.446, $aRes[1], 'degrees decimal ' . $sQuery, 0.01); $this->assertEqualsWithDelta(40.446, $aRes[1], 0.01, 'degrees decimal ' . $sQuery);
$this->assertEquals(-79.982, $aRes[2], 'degrees decimal ' . $sQuery, 0.01); $this->assertEqualsWithDelta(-79.982, $aRes[2], 0.01, 'degrees decimal ' . $sQuery);
$this->assertEquals($sQuery, $aRes[0]); $this->assertEquals($sQuery, $aRes[0]);
} }
} }

View File

@@ -9,7 +9,7 @@ class SearchContextTest extends \PHPUnit\Framework\TestCase
private $oCtx; private $oCtx;
protected function setUp() protected function setUp(): void
{ {
$this->oCtx = new SearchContext(); $this->oCtx = new SearchContext();
} }

View File

@@ -7,7 +7,7 @@ require_once(CONST_BasePath.'/lib/TokenList.php');
class TokenTest extends \PHPUnit\Framework\TestCase class TokenTest extends \PHPUnit\Framework\TestCase
{ {
protected function setUp() protected function setUp(): void
{ {
$this->oNormalizer = $this->getMockBuilder(\MockNormalizer::class) $this->oNormalizer = $this->getMockBuilder(\MockNormalizer::class)
->setMethods(array('transliterate')) ->setMethods(array('transliterate'))

View File

@@ -34,15 +34,18 @@ export DEBIAN_FRONTEND=noninteractive #DOCS:
python3-psycopg2 python3-tidylib git python3-psycopg2 python3-tidylib git
# If you want to run the test suite, you need to install the following # If you want to run the test suite, you need to install the following
# additional packages: # additional packages including the PHP package manager composer:
sudo apt-get install -y phpunit php-cgi
pip3 install --user behave nose 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=*" composer global require "squizlabs/php_codesniffer=*"
sudo ln -s ~/.config/composer/vendor/bin/phpcs /usr/bin/ 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 # System Configuration
# ==================== # ====================