From 81c793551d2bd6c2919a9a46462d464965c8207f Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Mon, 31 May 2021 13:28:25 +0300 Subject: Adding PHPUnit 8 --- composer.json | 2 +- tests/Bootstrap.php | 7 +++++++ tests/codeigniter/Setup_test.php | 2 +- tests/mocks/ci_testcase.php | 16 +++++++++++++++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index aac516c8a..a20d0f336 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,6 @@ }, "require-dev": { "mikey179/vfsstream": "1.6.*", - "phpunit/phpunit": "4.* || 5.*" + "phpunit/phpunit": "4.* || 5.* || 8.*" } } diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index b4e56bdae..ada6a5998 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -65,6 +65,13 @@ else is_php('5.6') && ini_set('php.internal_encoding', 'UTF-8'); +if (is_php('7.0')) +{ + $test_case_code = file_get_contents(PROJECT_BASE.'vendor/phpunit/phpunit/src/Framework/TestCase.php'); + $test_case_code = preg_replace('/^\s+((?:protected|public)(?: static)? function \w+\(\)): void/m', '$1', $test_case_code); + file_put_contents(PROJECT_BASE.'vendor/phpunit/phpunit/src/Framework/TestCase.php', $test_case_code); +} + include_once SYSTEM_PATH.'core/compat/mbstring.php'; include_once SYSTEM_PATH.'core/compat/hash.php'; include_once SYSTEM_PATH.'core/compat/password.php'; diff --git a/tests/codeigniter/Setup_test.php b/tests/codeigniter/Setup_test.php index 5317c56c7..43545822a 100644 --- a/tests/codeigniter/Setup_test.php +++ b/tests/codeigniter/Setup_test.php @@ -1,6 +1,6 @@ expectException($exception_class); + $exception_message !== '' && $this->expectExceptionMessage($exception_message); + } + else + { + parent::setExpectedException($exception_class, $exception_message, $exception_code); + } + } } -- cgit v1.2.3-24-g4f1b