PHPUnit 9 Shift

The PHPUnit 9 Shift reviews your tests for any backward incompatible changes and automates the upgrade process to PHPUnit 9.


  • Running PHP 7.3 or higher.
  • Previously running PHPUnit 8 or higher.
  • Test classes within the tests folder.

Automated Changes

  • Adding return types to core TestCase methods.
  • Updating phpunit/phpunit composer dependency to ^9.0.
  • Converting uses of the removed assertInternalType to its type specific equivalent.
  • Detecting uses of the removed assertContains and converting to the string assertion when appropriate.
  • Automating the changes for renamed or methods such as expectExceptionMessageRegExp and assertEquals.
  • Detecting uses of removed annotations and assertions, such as @covers Classname::<*> and assertAttribute*.
  • Modernizing PHP syntax, such as the short array syntax.

Manual Changes

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

Still have questions? Message @laravelshift on Twitter or email