Update PHPUnit to 8.x (#11635)

* Shift return type of base TestCase methods

From the [PHPUnit 8 release notes][1], the `TestCase` methods below now declare a `void` return type:

- `setUpBeforeClass()`
- `setUp()`
- `assertPreConditions()`
- `assertPostConditions()`
- `tearDown()`
- `tearDownAfterClass()`
- `onNotSuccessfulTest()`

[1]: https://phpunit.de/announcements/phpunit-8.html

* Update PHPUnit to 8.x

Part of Laravel 6 upgrade

* Bump php versions

Co-authored-by: Laravel Shift <shift@laravelshift.com>
Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
Jellyfrog 2020-05-19 16:31:50 +02:00 committed by GitHub
parent ee4ae0b2af
commit 3985ce74ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 126 additions and 358 deletions

View File

@ -10,11 +10,11 @@ env:
matrix:
fast_finish: true
include:
- php: 7.3
- php: 7.4
env: SKIP_STYLE_CHECK=1
- php: 7.2
- php: 7.3
env: SKIP_UNIT_CHECK=1 BROWSER_TEST=1 CHROME_HEADLESS=1
- php: 7.1
- php: 7.2
env: SKIP_STYLE_CHECK=1 EXECUTE_BUILD_DOCS=true
cache:

View File

@ -64,7 +64,7 @@
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"php-parallel-lint/php-parallel-lint": "^1.1",
"phpunit/phpunit": "^7.5",
"phpunit/phpunit": "^8.0",
"squizlabs/php_codesniffer": "^3.5",
"staudenmeir/dusk-updater": "^1.1"
},

444
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5ad56c9f29af8001a68f769d40e25903",
"content-hash": "0e63b9a2283fe51ee594adc2574952ad",
"packages": [
{
"name": "amenadiel/jpgraph",
@ -1885,16 +1885,6 @@
"datetime",
"time"
],
"funding": [
{
"url": "https://opencollective.com/Carbon",
"type": "open_collective"
},
{
"url": "https://tidelift.com/funding/github/packagist/nesbot/carbon",
"type": "tidelift"
}
],
"time": "2020-03-31T13:43:19+00:00"
},
{
@ -2355,20 +2345,6 @@
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"funding": [
{
"url": "https://marcus.bointon.com/donations/",
"type": "custom"
},
{
"url": "https://github.com/Synchro",
"type": "github"
},
{
"url": "https://www.patreon.com/marcusbointon",
"type": "patreon"
}
],
"time": "2020-03-14T14:23:48+00:00"
},
{
@ -3172,20 +3148,6 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-30T11:41:10+00:00"
},
{
@ -3309,20 +3271,6 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-27T16:54:36+00:00"
},
{
@ -3380,20 +3328,6 @@
"env",
"environment"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-01-07T20:29:45+00:00"
},
{
@ -3450,20 +3384,6 @@
],
"description": "Symfony ErrorHandler Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-30T14:07:33+00:00"
},
{
@ -3534,20 +3454,6 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-27T16:54:36+00:00"
},
{
@ -3655,20 +3561,6 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-27T16:54:36+00:00"
},
{
@ -3724,20 +3616,6 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-30T14:07:33+00:00"
},
{
@ -3828,20 +3706,6 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-30T14:59:15+00:00"
},
{
@ -3976,20 +3840,6 @@
"polyfill",
"portable"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-02-27T09:26:54+00:00"
},
{
@ -4049,20 +3899,6 @@
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-09T19:04:49+00:00"
},
{
@ -4125,20 +3961,6 @@
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-09T19:04:49+00:00"
},
{
@ -4198,20 +4020,6 @@
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-09T19:04:49+00:00"
},
{
@ -4267,20 +4075,6 @@
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-02-27T09:26:54+00:00"
},
{
@ -4339,20 +4133,6 @@
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-02-27T09:26:54+00:00"
},
{
@ -4402,20 +4182,6 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-27T16:54:36+00:00"
},
{
@ -4492,20 +4258,6 @@
"uri",
"url"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-30T11:41:10+00:00"
},
{
@ -4640,20 +4392,6 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-27T16:54:36+00:00"
},
{
@ -4787,20 +4525,6 @@
"debug",
"dump"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-27T16:54:36+00:00"
},
{
@ -4860,20 +4584,6 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-30T11:41:10+00:00"
},
{
@ -5193,7 +4903,7 @@
"password",
"security"
],
"time": "2012-08-31T00:00:00+00:00"
"time": "2014-07-16T15:38:21+00:00"
}
],
"packages-dev": [
@ -6782,40 +6492,40 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "6.1.4",
"version": "7.0.10",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d"
"reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
"reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f1884187926fbb755a9aaf0b3836ad3165b478bf",
"reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-xmlwriter": "*",
"php": "^7.1",
"phpunit/php-file-iterator": "^2.0",
"php": "^7.2",
"phpunit/php-file-iterator": "^2.0.2",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-token-stream": "^3.0",
"phpunit/php-token-stream": "^3.1.1",
"sebastian/code-unit-reverse-lookup": "^1.0.1",
"sebastian/environment": "^3.1 || ^4.0",
"sebastian/environment": "^4.2.2",
"sebastian/version": "^2.0.1",
"theseer/tokenizer": "^1.1"
"theseer/tokenizer": "^1.1.3"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
"phpunit/phpunit": "^8.2.2"
},
"suggest": {
"ext-xdebug": "^2.6.0"
"ext-xdebug": "^2.7.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.1-dev"
"dev-master": "7.0-dev"
}
},
"autoload": {
@ -6841,7 +6551,7 @@
"testing",
"xunit"
],
"time": "2018-10-31T16:06:48+00:00"
"time": "2019-11-20T13:55:58+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -7034,53 +6744,52 @@
},
{
"name": "phpunit/phpunit",
"version": "7.5.20",
"version": "8.5.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "9467db479d1b0487c99733bb1e7944d32deded2c"
"reference": "8474e22d7d642f665084ba5ec780626cbd1efd23"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c",
"reference": "9467db479d1b0487c99733bb1e7944d32deded2c",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8474e22d7d642f665084ba5ec780626cbd1efd23",
"reference": "8474e22d7d642f665084ba5ec780626cbd1efd23",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.1",
"doctrine/instantiator": "^1.2.0",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"myclabs/deep-copy": "^1.7",
"phar-io/manifest": "^1.0.2",
"phar-io/version": "^2.0",
"php": "^7.1",
"phpspec/prophecy": "^1.7",
"phpunit/php-code-coverage": "^6.0.7",
"phpunit/php-file-iterator": "^2.0.1",
"ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.9.1",
"phar-io/manifest": "^1.0.3",
"phar-io/version": "^2.0.1",
"php": "^7.2",
"phpspec/prophecy": "^1.8.1",
"phpunit/php-code-coverage": "^7.0.7",
"phpunit/php-file-iterator": "^2.0.2",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-timer": "^2.1",
"sebastian/comparator": "^3.0",
"sebastian/diff": "^3.0",
"sebastian/environment": "^4.0",
"sebastian/exporter": "^3.1",
"sebastian/global-state": "^2.0",
"phpunit/php-timer": "^2.1.2",
"sebastian/comparator": "^3.0.2",
"sebastian/diff": "^3.0.2",
"sebastian/environment": "^4.2.2",
"sebastian/exporter": "^3.1.1",
"sebastian/global-state": "^3.0.0",
"sebastian/object-enumerator": "^3.0.3",
"sebastian/resource-operations": "^2.0",
"sebastian/resource-operations": "^2.0.1",
"sebastian/type": "^1.1.3",
"sebastian/version": "^2.0.1"
},
"conflict": {
"phpunit/phpunit-mock-objects": "*"
},
"require-dev": {
"ext-pdo": "*"
},
"suggest": {
"ext-soap": "*",
"ext-xdebug": "*",
"phpunit/php-invoker": "^2.0"
"phpunit/php-invoker": "^2.0.0"
},
"bin": [
"phpunit"
@ -7088,7 +6797,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "7.5-dev"
"dev-master": "8.5-dev"
}
},
"autoload": {
@ -7114,7 +6823,17 @@
"testing",
"xunit"
],
"time": "2020-01-08T08:45:45+00:00"
"funding": [
{
"url": "https://phpunit.de/donate.html",
"type": "custom"
},
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-04-23T04:39:42+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
@ -7403,23 +7122,26 @@
},
{
"name": "sebastian/global-state",
"version": "2.0.0",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4"
"reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4",
"reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4",
"reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4",
"shasum": ""
},
"require": {
"php": "^7.0"
"php": "^7.2",
"sebastian/object-reflector": "^1.1.1",
"sebastian/recursion-context": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
"ext-dom": "*",
"phpunit/phpunit": "^8.0"
},
"suggest": {
"ext-uopz": "*"
@ -7427,7 +7149,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "3.0-dev"
}
},
"autoload": {
@ -7450,7 +7172,7 @@
"keywords": [
"global state"
],
"time": "2017-04-27T15:39:26+00:00"
"time": "2019-02-01T05:30:01+00:00"
},
{
"name": "sebastian/object-enumerator",
@ -7639,6 +7361,52 @@
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"time": "2018-10-04T04:07:39+00:00"
},
{
"name": "sebastian/type",
"version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/type.git",
"reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3",
"reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3",
"shasum": ""
},
"require": {
"php": "^7.2"
},
"require-dev": {
"phpunit/phpunit": "^8.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Collection of value objects that represent the types of the PHP type system",
"homepage": "https://github.com/sebastianbergmann/type",
"time": "2019-07-02T08:10:15+00:00"
},
{
"name": "sebastian/version",
"version": "2.0.1",

View File

@ -35,7 +35,7 @@ class AuthHTTPTest extends DBTestCase
private $original_auth_mech;
private $server;
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
@ -44,7 +44,7 @@ class AuthHTTPTest extends DBTestCase
$this->server = $_SERVER;
}
public function tearDown(): void
protected function tearDown(): void
{
Config::set('auth_mechanism', $this->original_auth_mech);
$_SERVER = $this->server;

View File

@ -34,7 +34,7 @@ class AuthSSOTest extends DBTestCase
private $original_auth_mech = null;
private $server;
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
@ -468,7 +468,7 @@ class AuthSSOTest extends DBTestCase
$this->assertTrue($a->authSSOParseGroups() === 10);
}
public function tearDown(): void
protected function tearDown(): void
{
Config::set('auth_mechanism', $this->original_auth_mech);
Config::forget('sso');

View File

@ -33,7 +33,7 @@ class ConfigTest extends TestCase
{
private $config;
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
$this->config = new \ReflectionProperty(Config::class, 'config');

View File

@ -32,7 +32,7 @@ class DBSetupTest extends DBTestCase
{
protected $db_name;
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
$this->db_name = dbFetchCell('SELECT DATABASE()');

View File

@ -27,7 +27,7 @@ namespace LibreNMS\Tests;
abstract class DBTestCase extends TestCase
{
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
if (!getenv('DBTEST')) {
static::markTestSkipped('Database tests not enabled. Set DBTEST=1 to enable.');

View File

@ -32,7 +32,7 @@ class OSDiscoveryTest extends TestCase
{
private static $unchecked_files;
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();

View File

@ -36,7 +36,7 @@ class OSModulesTest extends DBTestCase
private $discoveryModules;
private $pollerModules;
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
@ -45,7 +45,7 @@ class OSModulesTest extends DBTestCase
$this->pollerModules = Config::get('poller_modules');
}
public function tearDown(): void
protected function tearDown(): void
{
// restore modules
Config::set('discovery_modules', $this->discoveryModules);

View File

@ -33,7 +33,7 @@ use LibreNMS\Tests\TestCase;
*/
class DatastoreTest extends TestCase
{
public function setUp() : void
protected function setUp() : void
{
parent::setUp();

View File

@ -36,7 +36,7 @@ class GraphiteStoreTest extends TestCase
{
protected $timestamp = 997464400;
public function setUp() : void
protected function setUp() : void
{
parent::setUp();
@ -44,7 +44,7 @@ class GraphiteStoreTest extends TestCase
Carbon::setTestNow(Carbon::createFromTimestamp($this->timestamp));
}
public function tearDown() : void
protected function tearDown() : void
{
// restore Carbon:now() to normal
Carbon::setTestNow();

View File

@ -37,7 +37,7 @@ class OpenTSDBStoreTest extends TestCase
{
protected $timestamp = 990464400;
public function setUp() : void
protected function setUp() : void
{
parent::setUp();
@ -45,7 +45,7 @@ class OpenTSDBStoreTest extends TestCase
Carbon::setTestNow(Carbon::createFromTimestamp($this->timestamp));
}
public function tearDown() : void
protected function tearDown() : void
{
// restore Carbon:now() to normal
Carbon::setTestNow();

View File

@ -41,7 +41,7 @@ use LibreNMS\Tests\TestCase;
*/
class PrometheusStoreTest extends TestCase
{
public function setUp() : void
protected function setUp() : void
{
parent::setUp();