Release Announcement for PHPUnit 5.4.0

Sebastian Bergmann edited this page Feb 8, 2017 · 6 revisions

The PHPUnit development team announces the immediate availability of PHPUnit 5.4.0. This release adds new features and fixes bugs. A detailed list of changes is available here.

New Features

  • The PHPUnit\Framework\TestCase::createMock() method was added for creating a test double. The creation of this test double is performed using best practice defaults (it is not possible to create a mock for a class or interface that does not exist, the __construct() and __clone() methods of the original class are not executed and the arguments passed to a method of the test double will not be cloned). If these defaults are not what you need then you can use the getMockBuilder() method to customize the test double generation using a fluent interface.
  • The configuration option registerMockObjectsFromTestArgumentsRecursively was added. When set to true (its default is false) arrays and objects graphs passed into tests using @dataProvider are recursively scanned for mock objects so that they can be retain their behavior and expectations set up in the data provider when they are used in the test method.


  • The PHPUnit\Framework\TestCase::getMock() method has been deprecated. Please use PHPUnit\Framework\TestCase::createMock() or PHPUnit\Framework\TestCase::getMockBuilder() instead.
  • The PHPUnit\Framework\TestCase::getMockWithoutInvokingTheOriginalConstructor() method has been deprecated. Please use PHPUnit\Framework\TestCase::createMock() instead.

Obtaining PHPUnit 5.4

We distribute a PHP Archive (PHAR) that contains everything you need in order to use PHPUnit. Simply download it from here, make it executable, and put it into your $PATH, for instance.

Alternatively, you may use Composer to download and install PHPUnit as well as its dependencies.


PHPUnit 5.4 requires PHP 5.6; using the latest version of PHP is highly recommended. The documentation has a detailed list of the PHP extensions that are required to use PHPUnit.

Looking Ahead

The goal of our release process is to deliver new features into the hands of our users every two months. The next release with new features will be PHPUnit 5.5. It is currently in development and will become stable on August 4, 2016.

PHPUnit 6

PHPUnit 6, which is scheduled for February 3, 2017, will no longer support PHP 5. As PHPUnit follows Semantic Versioning the major version number must be incremented when the minimum required version of PHP is increased.

Support for PHPUnit 5

Following our release process, PHPUnit 5 will receive bug fixes until February 2, 2018.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.