PHPUnit

PHPUnit 4

The PHPUnit development team is pleased to announce the immediate availability of PHPUnit 4. This release adds new features, changes and removes existing features, and fixes bugs.

A detailed list of changes is available here.

Backward Compatibility Issues

  • The limited support for stubbing and mocking static methods that was introduced in PHPUnit 3.5 has been removed. This feature only worked when the stubbed or mocked static method was invoked from another method of the same class. We believe that the limited use of this feature did not justify the increased complexity in the test doubles code generator it incurred. We apologize for any inconvenience this removal may cause and encourage refactoring the code under test to not require this feature for testing.
  • The addRiskyTest() was added to the PHPUnit_Framework_TestListener interface. Classes that implement this interface have to implement this new method. This is the reason why PhpStorm 7 is not compatible with PHPUnit 4, for instance.
  • Bug fixes required a change to how relative paths are resolved for PHPUnit's XML configuration file. All relative paths in a configuration file are now resolved relative to that configuration file. When upgrading, you may need to update relative paths for the following configurations testSuiteLoaderFile, printerFile, testsuites/file, and testsuites/exclude.

Getting PHPUnit 4

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 March 7, 2014:

  • PHPUnit 4 receives bug fixes until February 3, 2017