Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Release Announcement for PHPUnit 4.0.0
The PHPUnit development team announces the immediate availability of PHPUnit 4.0.0. This release adds new features, removes existing features, and fixes bugs. A detailed list of changes is available here.
New Release Process
PHPUnit 4.0.0 is the first version of PHPUnit that follows our new release process. It is also the first release of PHPUnit to ship new features since September of 2012 when PHPUnit 3.7 was released. Our goal with the new release process is to deliver new features into the hands of our users every two months.
PHPUnit 4.0 introduces many new features. Here is a list of the highlights:
- Support for HHVM
- Test Proxies for more effective integration testing
@coversand addition of
@usesfor better code coverage analysis
- Fine grained control over the checks performed in strict mode
- Simplified stubbing of return values using the new willReturn*() syntax
- Support for the
- Support for Patch Coverage through
Backwards 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.
addRiskyTest()was added to the
PHPUnit_Framework_TestListenerinterface. 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.
- The fixes for #552, #573, and #582 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
- The numeric comparator is no longer invoked when provided with two strings.
- The simplified stubbing of return values using the new
willReturn*()syntax does not work for classes that have a method named
Obtaining PHPUnit 4.0
Alternatively, you may use Composer or the PEAR Installer to download and install PHPUnit as well as its dependencies.
Please note that starting with PHPUnit 4.0.0 the PEAR package of PHPUnit is merely a distribution mechanism for the PHP Archive (PHAR) and that many of PHPUnit's dependencies will no longer be released individually via PEAR. We will eventually stop making releases of PHPUnit available via PEAR altogether.
Please note that using the PEAR installer to update from PHPUnit 3.7 to PHPUnit 4.0 will leave stale source files from previous versions of PHPUnit's dependencies (PHP_CodeCoverage, PHPUnit_MockObject, ...) behind in your PHP environment's PEAR directory. It is advised to uninstall the respective PEAR packages.
PHPUnit 4.0 requires PHP 5.3.3; 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.