Monday, May 9, 2016

An Overview of PHPUnit 5 – What’s New? What’s Coming?

It was January 2016 when the PHPUnit development team announced the release of PHPUnit 5.0.

Color pen on paper, putting checkmarks into some boxes and red X-es into others

While several minor version have already been released since, PHPUnit's major version 5 has introduced several new functionalities and deprecated a few others. In this article, we'll take a look at the most notable changes.

Requirements

PHPUnit 5 requires PHP 5.6. They have dropped support for PHP 5.3, 5.4, and 5.5 as they are not actively supported by the PHP project, according to their release process. You can see the full list of required PHP extensions here.

New Assertion Methods

Three assertion methods including assertFinite(), assertInfinite() and assertNan() have been added to the stack.

assertFinite() asserts that the expected value is a finite value, meaning it is a legal number within the allowed range for a PHP float on the platform on which the test runs. Behind the scenes, it uses PHP's built-in function is_finite, to check if the constraint is met.

Consider the following test:

Continue reading %An Overview of PHPUnit 5 – What’s New? What’s Coming?%


by Reza Lavaryan via SitePoint

No comments:

Post a Comment