[wp-trac] [WordPress Trac] #46149: PHPUnit 8.x support
WordPress Trac
noreply at wordpress.org
Wed Jan 30 14:18:25 UTC 2019
#46149: PHPUnit 8.x support
------------------------------+-----------------------------
Reporter: SergeyBiryukov | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version:
Severity: normal | Keywords:
Focuses: |
------------------------------+-----------------------------
Background: #43218
PHPUnit 8.0.0 is scheduled for February 2019. The
[https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-8.0.md
changelog] includes some backwards compatibility breaks.
From the [https://phpunit.de/announcements/phpunit-7.html PHPUnit 7
announcement] (February 2, 2018):
> **Looking Forward**
>
> The following methods do not have a return value and should therefore
have a `void` return type declaration:
>
> * `PHPUnit\Framework\TestCase::setUpBeforeClass()`
> * `PHPUnit\Framework\TestCase::setUp()`
> * `PHPUnit\Framework\TestCase::assertPreConditions()`
> * `PHPUnit\Framework\TestCase::assertPostConditions()`
> * `PHPUnit\Framework\TestCase::tearDown()`
> * `PHPUnit\Framework\TestCase::tearDownAfterClass()`
> * `PHPUnit\Framework\TestCase::onNotSuccessfulTest()`
>
> These methods will have a `void` return type declaration in PHPUnit 8.
Please declare your methods that overwrite the above mentioned methods
`void` now so you are not affected by this backward compatibility break.
This is now [https://github.com/sebastianbergmann/phpunit/issues/3288
implemented in PHPUnit 8], so our method signatures are no longer
compatible and cause fatal errors:
> `Fatal error: Declaration of WP_UnitTestCase_Base::setUpBeforeClass()
must be compatible with PHPUnit\Framework\TestCase::setUpBeforeClass():
void in tests/phpunit/includes/abstract-testcase.php on line 1110`
We could look into using different signatures for different PHPUnit
versions in the same way as in [44701]. However, given the large number of
tests extending the `::setUp()` and `::tearDown()` methods, it's probably
easier to address this when we [https://make.wordpress.org/core/2018/12/08
/updating-the-minimum-php-version/ bump the required PHP version to 7].
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46149>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list