[wp-trac] [WordPress Trac] #43218: PHPUnit 7.x support
WordPress Trac
noreply at wordpress.org
Mon Jan 28 16:45:54 UTC 2019
#43218: PHPUnit 7.x support
------------------------------------------------+--------------------------
Reporter: ayeshrajans | Owner:
| SergeyBiryukov
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 5.1
Component: Build/Test Tools | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch needs-docs needs-testing | Focuses:
------------------------------------------------+--------------------------
Comment (by SergeyBiryukov):
Replying to [comment:29 desrosj]:
> On PHPUnit 7:
>
>
> {{{
> 1) WP_Test_REST_Schema_Sanitization::test_type_string
> Failed asserting that two strings are equal.
> --- Expected
> +++ Actual
> @@ @@
> -'1.10'
> +'1.1'
> /home/travis/build/WordPress/wordpress-develop/tests/phpunit/tests/rest-
api/rest-schema-sanitization.php:41
> }}}
This appears to be an error in the test. The value actually passed to
`rest_sanitize_value_from_schema()` in this case is `float(1.1)`, and the
output is `string(3) "1.1"`, as expected.
In PHPUnit 7.1 and older versions, this passes:
{{{
$this->assertEquals( '1.10', '1.1' );
}}}
In PHPUnit 7.2+, it does not.
We can fix the test by checking for both `1.1` float and `'1.10'` string
explicitly.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43218#comment:37>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list