Shift with red gradient lettering
Loading navigation...

PHPUnit 10 Shift

The PHPUnit 10 Shift automates the upgrade of your PHPUnit 9 test suite to PHPUnit 10. Using the PHPUnit 10 Shift to automatically upgrade your PHPUnit test suite has an estimated time savings of 1 hour.

Screenshot of a pull request with automated changes from the PHPUnit 10 Shift

Requirements

  • Running PHP 8.1 or higher.
  • Previously running PHPUnit 9 or higher.
  • Test classes within the tests folder.

Automated Changes

  • Updating phpunit/phpunit composer dependency to ^10.0.
  • Bumping community package dependencies for PHPUnit 10.
  • Renaming core assertions, such as assertDirectoryNotExists to assertDirectoryDoesNotExist.
  • Detecting calls to removed assertions, such as assertEqualXMLStructure.
  • Adopting PHP attributes instead of DocBlock annotations in test classes.
  • Marking data providers as static.
  • Adding return types to test cases and data providers.
  • Declaring test classes as final.

Manual Changes

While the PHPUnit 10 Shift addresses most of the backward incompatible changes, you may wish to review the release notes for additional details.