PHPUnit 5 in PhpStorm 9.5
PHPUnit 5 has been released, and brings a number of improvements to the most widely used testing framework in PHP. All of the new features and improvements in PHPUnit 5 are supported by PhpStorm 9.5. Let’s take a look at what’s new!
The big news is that PHPUnit 5 will no longer support versions of PHP lower than 5.6; but it will support PHP 7. This is great news for those who can push forward their PHP versions, but not such good news for those who are locked onto a specific version of PHP. PhpStorm 9.5 already fully supports PHP 5.6, and most PHP 7 features.
Features marked as deprecated in the latter releases of PHPUnit 4 have now been fully removed in 5. These include some assertions (
NotTag), some configuration relating to Selenium integration, and the
--strict command line argument. Strict mode should now be invoked via a configuration file setting.
There have also been a number of improvements. The way
@depends works has been changed – expectations for mock objects that are passed by
@depends are evaluated in the test, which is useful in those places where you expect mocked methods to be called in every dependent test.
Tests marked as
@small (the default for tests that aren’t size marked) can also be marked as risky if they perform I/O. This should help avoid tests timing out when they perform I/O as the default timeout for small tests is 1 second. Test failures can now be sorted in reverse, and most usefully, a new convenience method
getMockWithoutInvokingTheOriginalConstructor was added to quickly create a test double without invoking the original constructor. This will be a useful addition since many developers will be creating mocks without the constructor in lots of tests.
--whitelist command line argument has been added which allows you to configure a whitelist of classes for code coverage analysis (using Xdebug).
Finally, a number of new assertions have been added:
assertInfinite– checks that given value is infinite (see is_infinite)
assertFinite– checks that the given value is a finite value (i.e. not infinite)
assertNan– checks that the given value is not a number (see is_nan)
Support for all the new and improved features of PHPUnit 5 is already included in PhpStorm 9.5, and the team at PHPUnit have added a new test result logger into PHPUnit 5 that allows integration with PhpStorm to be even more seamless!
Develop with pleasure!
– JetBrains PhpStorm Team
Subscribe to Blog updates
Thanks, we've got you!
Qodana Clone Finder: Early Access Program
In December 2020, we announced the EAP for Qodana, which is rapidly evolving into a comprehensive platform that allows companies to perform multi-level evaluations of the quality of code they own, contract, or purchase. Qodana helps you detect bugs without relying on an IDE, either on a local machi…
PhpStorm 2020.2 EAP #3
The Early Access Program for PhpStorm 2020.2 is in full swing and today we’ve got the third build of the 2020.2 EAP for you. In this blog post, you can read about improvements for Git installed in WSL2 and Search Everywhere. Download PhpStorm 2020.2 EAP (more…)…
PhpStorm 2019.3.3 Preview
We’ve just rolled out a preview for the third minor update for PhpStorm 2019.3. Please give the PhpStorm 2019.3.3 Preview build 193.6494.5 a try and share your feedback with us. (more…)…
How to Upgrade to PHP 7.4 with PhpStorm
Check out our fresh video with a few nice tips and tricks on how to update your codebase to PHP 7.4. It combines materials from the PhpStorm 2019.2 and PhpStorm 2019.3 releases, with a few cool bonuses to boot. Nikita drew our attention to the fact that setters are slower than assigning prop…