From 103d1443ec6c552ff1c15e2bddbb9ce7c96528be Mon Sep 17 00:00:00 2001 From: Fabien Villepinte Date: Fri, 3 May 2024 15:45:43 +0200 Subject: [PATCH 1/2] Fix all PHPUnit's deprecations --- .github/workflows/tests.yml | 14 +++++++++++++- tests/Hamcrest/UtilTest.php | 23 +++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f23413216..68b483587 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,19 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] + php: + - '5.3' + - '5.4' + - '5.5' + - '5.6' + - '7.0' + - '7.1' + - '7.2' + - '7.3' + - '7.4' + - '8.0' + - '8.1' + - '8.2' name: PHP ${{ matrix.php }} diff --git a/tests/Hamcrest/UtilTest.php b/tests/Hamcrest/UtilTest.php index 7248978c7..1fec63eed 100644 --- a/tests/Hamcrest/UtilTest.php +++ b/tests/Hamcrest/UtilTest.php @@ -28,21 +28,28 @@ public function testCheckAllAreMatchersAcceptsMatchers() )); } - /** - * @expectedException InvalidArgumentException - */ public function testCheckAllAreMatchersFailsForPrimitive() { - \Hamcrest\Util::checkAllAreMatchers(array( - new \Hamcrest\Text\MatchesPattern('/fo+/'), - 'foo', - )); + $exceptionThrown = false; + try { + \Hamcrest\Util::checkAllAreMatchers(array( + new \Hamcrest\Text\MatchesPattern('/fo+/'), + 'foo', + )); + } catch (\InvalidArgumentException $exception) { + $exceptionThrown = true; + } + + $this->assertTrue( + $exceptionThrown, + 'Failed asserting that exception of type "InvalidArgumentException" is thrown.' + ); } private function callAndAssertCreateMatcherArray($items) { $matchers = \Hamcrest\Util::createMatcherArray($items); - $this->assertInternalType('array', $matchers); + $this->assertTrue(is_array($matchers), sprintf('Type "array" expected, but got "%s" instead', gettype($matchers))); $this->assertSameSize($items, $matchers); foreach ($matchers as $matcher) { $this->assertInstanceOf('\Hamcrest\Matcher', $matcher); From e3b7bfcda4bc88f94e7f37f2a3a3380d4944735d Mon Sep 17 00:00:00 2001 From: Fabien Villepinte Date: Fri, 3 May 2024 15:50:55 +0200 Subject: [PATCH 2/2] Allow installation of PHPUnit 9 in order to test with PHP 8.3 --- .github/workflows/tests.yml | 1 + composer.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 68b483587..de0cfff6f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,6 +23,7 @@ jobs: - '8.0' - '8.1' - '8.2' + - '8.3' name: PHP ${{ matrix.php }} diff --git a/composer.json b/composer.json index 180f341d8..c89b279e1 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,8 @@ }, "require-dev": { - "phpunit/php-file-iterator": "^1.4 || ^2.0", - "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0 || ^8.0" + "phpunit/php-file-iterator": "^1.4 || ^2.0 || ^3.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0 || ^8.0 || ^9.0" }, "replace": {