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

PHPUnit 10 Shift #117

Closed
wants to merge 7 commits into from
Closed

PHPUnit 10 Shift #117

wants to merge 7 commits into from

Conversation

glorand
Copy link
Owner

@glorand glorand commented Mar 5, 2024

This pull request contains changes for upgrading to PHPUnit 10 automated by the PHPUnit 10 Shift.

Before merging, you need to:

  • Checkout the shift-111483 branch
  • Review all pull request comments for additional changes
  • Run composer update (if the scripts fail, add --no-scripts)
  • Run your tests suite: vendor/bin/phpunit

If there were changes you felt could have been automated, please reply to the follow-up email with your feedback or on Twitter.

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
@glorand
Copy link
Owner Author

glorand commented Mar 5, 2024

⚠️ PHPUnit 10 has made several changes to the configuration file. After running composer update, you may run vendor/bin/phpunit --migrate-configuration to have PHPUnit upgrade your configuration file.

@glorand
Copy link
Owner Author

glorand commented Mar 5, 2024

❌ PHPUnit 10 has removed the --verbose option. Shift detected potential uses of this option in the following files. You should review these files and remove the --verbose option when calling phpunit.

  • composer.json

@glorand
Copy link
Owner Author

glorand commented Mar 5, 2024

❌ The following assertions have been removed in PHPUnit 10: assertClassHasAttribute, assertClassNotHasAttribute, assertClassHasStaticAttribute, assertClassNotHasStaticAttribute, classHasAttribute, classHasStaticAttribute, assertEqualXMLStructure, expectDeprecation, expectDeprecationMessage, expectDeprecationMessageMatches, expectError, expectErrorMessage, expectErrorMessageMatches, expectNotice, expectNoticeMessage, expectNoticeMessageMatches, expectWarning, expectWarningMessage, expectWarningMessageMatches

Shift detected calls to these assertions in the following files. As these do not have a replacement, you will need to either remove or recreate the assertion.

  • tests/TableSettingsManagerTest.php

@glorand
Copy link
Owner Author

glorand commented Mar 5, 2024

ℹ️ PHPUnit has documented using return types for test cases and data providers since PHPUnit 8. In an effort to modernize your test suite, Shift added a return type of void to your test cases and a return type of array to your data providers.

Shift understands developers have different preferences when it comes to type hints. If you do not wish to add return types, you may undo this change by running: git revert 329e6a23

@glorand
Copy link
Owner Author

glorand commented Mar 5, 2024

ℹ️ PHPUnit has documented declaring test classes as final since PHPUnit 8. In an effort to modernize your test suite, Shift has declared your test classes as final.

Shift understands developers have different preferences when it comes to using final. If you do not wish to declare your test classes as final, you may undo this change by running: git revert 3103898e

@glorand
Copy link
Owner Author

glorand commented Mar 5, 2024

⚠️ PHPUnit 10 now requires any base test class to have a TestCase suffix. In addition, this class should be defined as abstract. If you have a custom base test class, you should ensure it meets these new requirements.

@glorand
Copy link
Owner Author

glorand commented Mar 5, 2024

⚗️ This Shift is still being refined. Please report any issues or suggestions to [email protected]. Your feedback is what helps improve the experience for everyone.

Copy link

codeclimate bot commented Mar 5, 2024

Code Climate has analyzed commit 3103898 and detected 0 issues on this pull request.

View more on Code Climate.

@glorand glorand closed this Mar 13, 2024
@glorand
Copy link
Owner Author

glorand commented Mar 13, 2024

Was merge into develop

@glorand glorand deleted the shift-111483 branch March 13, 2024 09:56
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