Preparing for PHPUnit 6

Sebastian Bergmann edited this page Dec 31, 2016 · 3 revisions

As of December 3, 2016 there are two supported versions of PHPUnit:

  • PHPUnit 5.7 is the current stable release. It is supported on PHP 5.6, PHP 7.0, and PHP 7.1. The support for PHPUnit 5.7 ends on February 2, 2018.
  • PHPUnit 4.8 is the old stable release. It is supported on PHP 5.3, PHP 5.4, PHP 5.5, and PHP 5.6. The support for PHPUnit 4.8 ends on February 3, 2017.

As of December 3, 2016 there are three versions of PHP that are actively supported by the PHP project:

  • PHP 7.1 is actively supported until December 1, 2018.
  • PHP 7.0 is actively supported until December 3, 2017.
  • PHP 5.6 is actively supported until December 31, 2016.

As you can see above, active support for PHP 5 from the PHP project ends on December 31, 2016. This is the reason why the next version of PHPUnit will no longer support PHP 5. Please refer to the website of the PHP project for more information on the actively supported versions of PHP.

We increment the major version number of PHPUnit when the minimum required version of PHP is increased. And because a new major version allows for breaking changes we use the opportunity to change default behaviour and remove deprecated functionality.

The next version of PHPUnit will be PHPUnit 6. PHPUnit 6.0.0 will be released on February, 3 2017. The support for PHPUnit 4.8 ends on that same day. Following our release process, PHPUnit 5.7 will receive bug fixes until February 2, 2018.

Avoid unwanted surprises on February, 3 2017

PHP Archive (PHAR)

If you use Chef, Puppet, or a similar tool to download and install a PHP archive (PHAR) of PHPUnit then you should change the download URL you use.

For PHPUnit 5.7 use https://phar.phpunit.de/phpunit-5.7.phar instead of https://phar.phpunit.de/phpunit.phar. If you continue to use https://phar.phpunit.de/phpunit.phar then you would install PHPUnit 6 as soon as it is available. Considering the significant changes introduced in PHPUnit this is most likely not what you want.

For PHPUnit 4.8 use https://phar.phpunit.de/phpunit-4.8.phar instead of https://phar.phpunit.de/phpunit-old.phar. The URL https://phar.phpunit.de/phpunit-old.phar will not be offered in the future anymore. It will continue to work for now and it will always redirect to the latest version of PHPUnit 4.8.

Composer

If you use Composer to manage the dependencies of your project then please make sure that you use the caret (^) operator in the version constraint for the dependency on PHPUnit in your composer.json file:

{
    "require-dev": {
        "phpunit/phpunit": "^5.0"
    }
}

If you would use the >= version constraint operator ("phpunit/phpunit": ">=5.0") instead then you would install PHPUnit 6 as soon as it is available. Considering the significant changes introduced in PHPUnit this is most likely not what you want.

Test PHPUnit 6 before its release

Nightly builds from the master branch (where PHPUnit 6 is developed) are available at https://phar.phpunit.de/phpunit-nightly.phar.

You can also use Composer to install a development version of PHPUnit 6:

{
    "minimum-stability": "dev",
    "require-dev": {
        "phpunit/phpunit": "^6.0"
    }
}

All users of PHPUnit are encouraged to test PHPUnit 6 while it is being developed and report any bugs in the issue tracker. Thank you for helping us make PHPUnit better.