[wp-trac] [WordPress Trac] #53844: Fix four warnings in the test suite
WordPress Trac
noreply at wordpress.org
Tue Nov 23 18:55:37 UTC 2021
#53844: Fix four warnings in the test suite
---------------------------------------------+-----------------------------
Reporter: jrf | Owner: hellofromTonya
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 5.9
Component: Build/Test Tools | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch commit has-unit-tests | Focuses: rest-api
---------------------------------------------+-----------------------------
Changes (by hellofromTonya):
* status: reviewing => closed
* resolution: => fixed
Comment:
In [changeset:"52235" 52235]:
{{{
#!CommitTicketReference repository="" revision="52235"
Build/Test Tools: Fix warnings from `stdClass::__invoke()` callback mocks
in REST API tests.
When running core tests on PHPUnit 8.x and 9.x, four non-blocking warnings
were displayed for the REST API tests:
{{{
There were 4 warnings:
1) Tests_REST_Request::test_route_level_validate_callback
createPartialMock called with method(s) __invoke that do not exist in
stdClass. This will not be allowed in future versions of PHPUnit.
2)
Tests_REST_Request::test_route_level_validate_callback_no_parameter_callbacks
createPartialMock called with method(s) __invoke that do not exist in
stdClass. This will not be allowed in future versions of PHPUnit.
3)
Tests_REST_Request::test_route_level_validate_callback_is_not_executed_if_parameter_validation_fails
createPartialMock called with method(s) __invoke that do not exist in
stdClass. This will not be allowed in future versions of PHPUnit.
4)
Tests_REST_Server::test_callbacks_are_not_executed_if_request_validation_fails
createPartialMock called with method(s) __invoke that do not exist in
stdClass. This will not be allowed in future versions of PHPUnit.
}}}
These warnings are due to the PHP native `stdClass` not having a
`__invoke()` method declared.
This commit adds a `Mock_Invokable` reusable class and replaces the
`stdClass` with this new class.
Follow-up to [48945], [48947].
Props sourovroy, jrf.
Fixes #53844.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53844#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list