Update the test suite to run with a wider range of PHP versions
This PR fixes all deprecations from PHPUnit with minimal changes. That way the tests can be run from PHP 5.3 up to PHP 8.3.
1) Hamcrest\UtilTest::testCheckAllAreMatchersFailsForPrimitive
The @expectedException, @expectedExceptionCode, @expectedExceptionMessage, and @expectedExceptionMessageRegExp annotations are deprecated. They will be removed in PHPUnit 9. Refactor your test to use expectException(), expectExceptionCode(), expectExceptionMessage(), or expectExceptionMessageMatches() instead.
2) Hamcrest\UtilTest::testCreateMatcherArrayLeavesMatchersUntouched
assertInternalType() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertIsArray() instead.
3) Hamcrest\UtilTest::testCreateMatcherArrayWrapsPrimitiveWithIsEqualMatcher
assertInternalType() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertIsArray() instead.
4) Hamcrest\UtilTest::testCreateMatcherArrayDoesntModifyOriginalArray
assertInternalType() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertIsArray() instead.
5) Hamcrest\UtilTest::testCreateMatcherArrayUnwrapsSingleArrayElement
assertInternalType() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertIsArray() instead.
FYI: I've used https://github.com/Yoast/PHPUnit-Polyfills in my other projects and this way the test suite only uses the latest PHPUnit methods, which are polyfilled for older PHPUnit versions.
PR looks good to me.
FYI: I've used https://github.com/Yoast/PHPUnit-Polyfills in my other projects and this way the test suite only uses the latest PHPUnit methods, which are polyfilled for older PHPUnit versions.
True. On my own projects I use Symfony's PHPUnit bridge.
However, I chose not to add a new dependency because I believed the pull request would be better received that way, especially since it didn't require many changes.
Hi @aik099, Do you think it's ok to merge this PR as is?
Merging, thank you @villfa .