This outputs a proper message if the requirement is not met, instead of an obscure failure further in the test.
These tests rely on multiple resized copies of a test JPEG image being generated and available.
Follow-up to [49010], [49024], [49025], [49045].
See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49047
git-svn-id: http://core.svn.wordpress.org/trunk@48809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
If the sizes data could not be retrieved, the controller returns an empty object instead of an array.
This makes sure that the value is in fact an array before proceeding, and outputs a proper message in case of failure, instead of an obscure PHP error further in the test.
Follow-up to [49044].
See #50913, #51393.
Built from https://develop.svn.wordpress.org/trunk@49046
git-svn-id: http://core.svn.wordpress.org/trunk@48808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This outputs a proper message if the requirement is not met, instead of an obscure PHP error further in the test.
These tests rely on multiple resized copies of a test JPEG image being generated and available.
Follow-up to [49010], [49024], [49025].
See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49045
git-svn-id: http://core.svn.wordpress.org/trunk@48807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison
In particular, checking if a non-empty, non-numeric string is greater than zero in PHP 8 evaluates to `true`, not `false`.
For `wp_insert_term()`, this resulted in a "Parent term does not exist" error for a non-numeric string, instead of discarding the value.
By explicitly casting the value to `int`, we make sure to compare both values as numbers, rather than a string and a number.
Follow-up to [29196], [29830], [29867].
See #50913.
Built from https://develop.svn.wordpress.org/trunk@49043
git-svn-id: http://core.svn.wordpress.org/trunk@48805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This revision includes a change to only call `libxml_disable_entity_loader()` in PHP < 8, in order for unit tests in the `import` group to pass on PHP 8.
This function has been deprecated in PHP 8.0 because in libxml 2.9.0, external entity loading is disabled by default, so this function is no longer needed to protect against XXE attacks.
Follow-up to [46542], [48789].
Props jrf.
See #50913.
Built from https://develop.svn.wordpress.org/trunk@49039
git-svn-id: http://core.svn.wordpress.org/trunk@48801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Replace the `Match` interface with `ParametersMatch`, to avoid parse errors due to `match` being a reserved keyword in PHP 8.
* Replace `ReflectionParameter::getClass()` usage, which is deprecated in PHP 8.
This allows tests relying on the `getMockForAbstractClass()` and `getMockBuilder()` methods to run again on PHP 8.
When the test suite is updated for compatibility with PHPUnit 9.x, these overrides can be removed.
Follow-up to [48972].
See #50913, #50902.
Built from https://develop.svn.wordpress.org/trunk@49037
git-svn-id: http://core.svn.wordpress.org/trunk@48799 1a063a9b-81f0-0310-95a4-ce76da25c4cd
These actions allow debugging tools to track `WP_Error` instances as they're created and subsequently passed between functions which check for error objects.
Props Shelob9, Mte90, TimothyBlynJacobs, johnbillion
Fixes#40568
Built from https://develop.svn.wordpress.org/trunk@49022
git-svn-id: http://core.svn.wordpress.org/trunk@48784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The explicit message brings some consistency with other image editor tests, specifically the ones using the `WP_Image_UnitTestCase` class.
Previously, the tests were marked as "risky" in that scenario, due to performing no assertions.
See #50639, #50640.
Built from https://develop.svn.wordpress.org/trunk@49009
git-svn-id: http://core.svn.wordpress.org/trunk@48771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The tests ensure that `rest_sanitize_value_from_schema()` and `rest_validate_value_from_schema()` throw an "undefined offset" notice when the required `type` schema keyword is not passed.
In PHP 8, that notice is now a warning, so the tests need to be adjusted accordingly.
Follow-up to [48300], [48993].
See #50913.
Built from https://develop.svn.wordpress.org/trunk@49007
git-svn-id: http://core.svn.wordpress.org/trunk@48769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Transitioning posts from `auto-draft` to `publish` via `wp_publish_post()` could result in published posts without the default category or custom taxonomy default terms.
Props frank-klein, TimothyBlynJacobs, peterwilsoncc.
Fixes#51292.
Built from https://develop.svn.wordpress.org/trunk@49000
git-svn-id: http://core.svn.wordpress.org/trunk@48762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, the test had to use an older pattern for catching the generic `Exception` exceptions for compatibility with PHPUnit 3.6 on PHP 5.2.
Now that WordPress supports PHPUnit 5.4 as the minimum version, the `expectException()` method can be used directly.
Follow-up to [41725], [41730].
See #51344.
Built from https://develop.svn.wordpress.org/trunk@48999
git-svn-id: http://core.svn.wordpress.org/trunk@48761 1a063a9b-81f0-0310-95a4-ce76da25c4cd