Shift with red gradient lettering
Loading navigation...

PHPUnit 13 Shift

The PHPUnit 13 Shift automates the upgrade of your PHPUnit 11 test suite to PHPUnit 13. Using the PHPUnit 13 Shift to automatically upgrade your PHPUnit test suite has an estimated time savings of 30 minutes.

PHPUnit 13 is the latest stable release. This means both PHPUnit and the PHPUnit 13 Shift will continue to receive updates.

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

Requirements

  • Running PHP 8.4 or higher.
  • Previously running PHPUnit 12 or higher.
  • Test classes within the tests folder.

Automated Changes

  • Updating phpunit/phpunit composer dependency to ^13.0.
  • Bumping community package dependencies for PHPUnit 13.
  • Replacing type-parameterized assertions and constraints (isType(), containsOnly(), assertContainsOnly(), assertNotContainsOnly()) with their type-specific methods.
  • Replacing the #[RunClassInSeparateProcess] attribute with #[RunTestsInSeparateProcesses].
  • Renaming Configuration::includeTestSuite() and excludeTestSuite() to their plural forms.
  • Updating hook event testClassName() calls to test()->className().
  • Adopting expectExceptionMessageIsOrContains() in place of expectExceptionMessage().
  • Adding an explicit version comparison operator to #[RequiresPhp], #[RequiresPhpunit], and #[RequiresPhpExtension] attributes.
  • Updating deprecated duration/size execution order values to their -ascending equivalents.
  • Renaming the --dont-report-useless-tests CLI option.
  • Detecting calls to deprecated features, such as the any() matcher, non-positive atLeast() arguments, and method-level #[CoversNothing].

Manual Changes

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