Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the test suite to run with a wider range of PHP versions #83

Merged
merged 2 commits into from
Jul 8, 2024

Conversation

villfa
Copy link
Contributor

@villfa villfa commented May 3, 2024

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.

@aik099
Copy link
Member

aik099 commented May 3, 2024

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.

@villfa
Copy link
Contributor Author

villfa commented May 3, 2024

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.

@villfa
Copy link
Contributor Author

villfa commented Jul 8, 2024

Hi @aik099,
Do you think it's ok to merge this PR as is?

@aik099 aik099 merged commit dd03e52 into hamcrest:master Jul 8, 2024
13 checks passed
@aik099
Copy link
Member

aik099 commented Jul 8, 2024

Merging, thank you @villfa .

@villfa villfa deleted the testing branch July 8, 2024 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants