PHPUnit 6

February 3, 2017

The PHPUnit development team announces the immediate availability of PHPUnit 6. This release adds new features, changes and removes existing features, and fixes bugs.

A detailed list of changes is available here.

PHPUnit now requires PHP 7.0 (or newer)

Active support for PHP 5.6 by the PHP project ended on December 31, 2016. The only actively supported versions of PHP as of February, 3 2017 are PHP 7.0 and PHP 7.1.

Backwards Compatibility Issues

  • PHPUnit's units of code are now namespaced. For instance, PHPUnit_Framework_TestCase is now PHPUnit\Framework\TestCase.
  • PHPUnit is now strict about useless tests by default. Use the --dont-report-useless-tests commandline option or the beStrictAboutTestsThatDoNotTestAnything="false" configuration directive to disable this risky test check.
  • Global and super-global variables are no longer backed up before and restored after each test by default. Use the --globals-backup commandline option or the backupGlobals="true" configuration directive to enable this feature.
  • The logfile format generated using the --log-junit option and the <log type="junit" target="..."/> configuration directive has been updated to match the current format used by JUnit. Due to this change you may need to update how your continuous integration server processes test result logfiles generated by PHPUnit.

This article has details on migrating from PHPUnit 4 or PHPUnit 5 to PHPUnit 6.

Getting PHPUnit 6

We distribute a PHP Archive (PHAR) that contains everything you need in order to use PHPUnit. Alternatively, you may use Composer to download and install PHPUnit as well as its dependencies.

Here is a tutorial that gets you started.

Supported Versions

Detailed information on supported versions of PHPUnit is available here. Below is a summary as of February 3, 2017:

  • PHPUnit 6 receives bug fixes until February 8, 2019
  • PHPUnit 5 receives bug fixes until February 2, 2018
  • PHPUnit 4 has reached its End of Life on February, 3 2017 and no longer receives bug fixes