The PHPUnit development team announces the immediate availability of PHPUnit 7. This release adds new features, changes and removes existing features, and fixes bugs.
A detailed list of changes is available here.
Active support for PHP 7.0 ended on December 3, 2017. The only actively supported versions of PHP as of February 2, 2018 are PHP 7.1 and PHP 7.2.
The first lines of code for PHPUnit were written back when PHP 4 was the "latest and greatest". In order to keep PHPUnit compatible with new versions of PHP and to make new features possible, the codebase of PHPUnit needs constant modernization.
It has cost Sebastian Bergmann thousands of hours to develop, test, and support PHPUnit.
A lot of time and effort went into the development of PHPUnit 7 to make better use of syntax features such as scalar type declarations and return type declarations, for instance, that were introduced in PHP 7. And quite a few methods that can raise exceptions were missing
@throws annotations, there were now added to the documentation of those methods.
While the aforementioned changes make PHPUnit's code easier to read and more robust to work on, they come at the price of backward compatibility breaks.
PHPUnit\Framework\TestListener, then you may need to update the signatures of your methods.
PHPUnit\Framework\TestCase, then you may need to update the signatures of your methods.
PHPUnit\Framework\BaseTestListenerclass has been removed, it was deprecated since PHPUnit 6.4. Please use the
@scenarioannotation is no longer an alias for
@test, it no longer has any effect.
PHPUnit\Framework\TestCase::prepareTemplate()template method has been removed.
The following methods do not have a return value and should therefore have a
void return type declaration:
These methods will have a
void return type declaration in PHPUnit 8. Please declare your methods that overwrite the above mentioned methods
void now so you are not affected by this backward compatibility break.
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.
Detailed information on supported versions of PHPUnit is available here. Below is a summary as of February 2, 2018: