Yoast / PHPUnit-Polyfills

Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests
BSD 3-Clause "New" or "Revised" License
173 stars 13 forks source link

Tests: tweaks to work round PHP 8.4 deprecation #159

Closed jrfnl closed 7 months ago

jrfnl commented 7 months ago

PHP 8.4 deprecates implicitly nullable parameters, i.e. typed parameter with a null default value, which are not explicitly declared as nullable.

The ValueObject fixture used in these tests used one such implicitly nullable parameters.

The tests for the AssertObjectEquals trait already needed two test classes to allow the method to be fully tests cross-version:

As the nullability operator was introduced in PHP 7.1 and the particular test affected does need to be typed to still test what it is supposed to test, I'm changing the requirements both test sets:

This way the tests still covers the trait sufficiently.

Note: the trait itself is not affected by the deprecation.

coveralls commented 7 months ago

Coverage Status

coverage: 96.232% (-1.0%) from 97.254% when pulling cee3353aa9c9b8391f6f26ad0d8688b406cf0422 on feature/assertobjectequalstests-fix-php-8.4-deprecation into e3a5bad2c69c147fbde4b8ad83f422bac3b36153 on 1.x.