Commit Graph

4547 Commits

Author SHA1 Message Date
Sergey Biryukov
27cfc58b34 Tests: Use a consistent way of setting the Administrator role in Ajax tests.
This removes some duplicate code in favor of calling the `WP_Ajax_UnitTestCase::_setRole()` method created specifically for this purpose and used in other tests.

Follow-up to [500/tests], [37288].

Props martin.krcho.
See #56203.

git-svn-id: https://develop.svn.wordpress.org/trunk@53701 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-14 14:26:37 +00:00
John Blackbourn
5c041f5777 Users: Allow conditional supression of the email notifications that are sent when a new user account is registered.
This introduces the following new filters:

* `wp_send_new_user_notification_to_admin`
* `wp_send_new_user_notification_to_user`

Props janthiel, costdev, audrasjb, peterwilsoncc

Fixes #54874


git-svn-id: https://develop.svn.wordpress.org/trunk@53698 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-12 21:03:39 +00:00
Greg Ziółkowski
537e5239f9 Tools: Automate backporting core blocks from Gutenberg to Core
Syncing stable blocks from the Gutenberg repository to wordpress-develop was a manual process, but it got automated with the script that runs together with syncing WordPress packages changed in the Gutenberg package.

Props zieladam.
Fixes #56179.




git-svn-id: https://develop.svn.wordpress.org/trunk@53688 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-08 12:32:37 +00:00
Sergey Biryukov
4b22694e76 Tests: Remove @uses tags from the test suite.
* These were not used consistently, with only four instances across all the tests.
* Using this tag in combination with the `beStrictAboutCoversAnnotation="true"` setting will mark a test as "Risky" if code is executed during the test which is not annotated via `@covers` or `@uses` tags. That would make the maintainance of the tags very fiddly, while adding little additional value for the test code base.

Follow-up to [32995], [39914], [42636], [53682].

Props jrf.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53687 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-08 00:11:15 +00:00
Sergey Biryukov
5880ac84cc Tests: Separate the tests in basic.php for clarity.
There were two kinds of tests in this file:

* Tests for content of some files in the root directory:
 * `license.txt`
 * `SECURITY.md`
 * `package.json`
* Tests for some utility functions of the test framework itself:
 * `strip_ws()`
 * `test_mask_input_value()`

The latter are now moved to their own file, `utils.php`.

Follow-up to [22/tests], [81/tests], [103/tests], [25240], [26940], [28064], [28480], [28493], [28523], [28631], [42381], [47403], [53683].

See #39265, #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53686 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 23:55:13 +00:00
Andrew Ozz
1329b0818d Build/Test Tools: Add @covers tags to the taxonomy and category test groups.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53684 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 23:00:07 +00:00
Andrew Ozz
faebeca64b Build/Test Tools: Add @coversNothing tags to the tests for some content in documentation and settings files.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53683 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 22:53:34 +00:00
Andrew Ozz
4790a10b8b Build/Test Tools: Add @covers tags to the url test group.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.


git-svn-id: https://develop.svn.wordpress.org/trunk@53682 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 22:43:37 +00:00
Andrew Ozz
b419dd47f7 Tests: Remove duplicate testcase test_get_privacy_policy_url_should_return_empty_when_privacy_policy_page_not_set() from Tests_Url_GetPrivacyPolicyUrl.
See: #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53681 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 22:20:18 +00:00
Andrew Ozz
599b7146ca Build/Test Tools: Add and fix @covers tags to the attachments and block-supports test groups.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53680 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 21:06:03 +00:00
Peter Wilson
0a17a80bcc Database: Ensure MySQL port numbers are numeric in wpdb.
Ensure the database port number is recorded as an integer or `null` (the default port) when parsing the database host.

This is to prevent PHP/MySQLi throwing an exception caused by ports represented as numeric strings.

Props audrasjb, azouamauriac, chaion07, costdev, johnjamesjacoby, jrf, sergeybiryukov.
Fixes #54877.


git-svn-id: https://develop.svn.wordpress.org/trunk@53670 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-06 05:31:47 +00:00
Peter Wilson
5b5c74b904 Taxonomy: Retain default term option when unregistering taxos.
No longer delete the default term option in `unregister_taxonomy()` to improve database performance.

Since taxonomies are registered at runtime and can't be unregistered unless they're already registered, prior to this 
change the option was created and deleted on each request.

Deleting the option should occur on a one-time opperation such as plugin deactivation.

Follow up to [48480].

Props dlh.
Fixes #54472.


git-svn-id: https://develop.svn.wordpress.org/trunk@53669 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-06 05:09:22 +00:00
Sergey Biryukov
ccbdd73187 Block Patterns: Update the value used for keywords.
Patterns on the [https://wordpress.org/patterns/ Pattern Directory] can have keywords for better discoverability while searching. The way these are stored [69548ff1f0 was changed from a taxonomy to meta value], but the `/wp/v2/pattern-directory/patterns` endpoint was still pulling from that old value.

The correct property to use for this field is `meta.wpop_keywords`, which returns a single string with comma-separated keywords.

Props ryelle, TimothyBlynJacobs.
See #56126.

git-svn-id: https://develop.svn.wordpress.org/trunk@53665 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-05 16:01:36 +00:00
Sergey Biryukov
de42031a94 Themes: Register the block-templates theme feature.
This ensures the feature is included in the `theme_supports` REST API data for the active theme.

Follow-up to [48171].

Props grantmkin, TimothyBlynJacobs, addiestavlo.
Fixes #55681.

git-svn-id: https://develop.svn.wordpress.org/trunk@53659 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-05 14:57:52 +00:00
Jonny Harris
2db7debe8a Users: Prime user meta in WP_User_Query class.
When querying 'fields' equal to 'all' using the `WP_User_Query` class, this returns an array of `WP_User` objects. A `WP_User` object requires user meta to be primed, as the user's role is stored in user meta. Ensure that all users meta is primed in a single request by calling the `cache_users` function when querying 'fields' equal to 'all'. Soft deprecate fields equal to `all_with_meta` as it now acts the same as 'fields' equal to 'all'.

Props Spacedmonkey, peterwilsoncc, mehulkaklotar, timothyblynjacobs, furi3r.
Fixes #55594.

git-svn-id: https://develop.svn.wordpress.org/trunk@53655 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-05 09:26:21 +00:00
Peter Wilson
59a99c13ac Media: Add tests for wp_img_tag_add_decoding_attr().
Add new tests skipped in original commit. Follow up to [53480].

Fixes #53232.



git-svn-id: https://develop.svn.wordpress.org/trunk@53652 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-05 00:46:54 +00:00
Sergey Biryukov
001f3f8dea Docs: Add @since tags for _doing_it_wrong() and deprecation notice handlers in the PHPUnit test suite.
This affects methods in the `WP_UnitTestCase_Base` class:
* `::expectDeprecated()`
* `::expectedDeprecated()`
* `::setExpectedException()`
* `::deprecated_function_run()`
* `::doing_it_wrong_run()`

Follow-up to [25402], [25408], [25785], [37861], [40536], [40539], [40872], [51872], [53637].

See #55652, #55646.

git-svn-id: https://develop.svn.wordpress.org/trunk@53638 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-03 17:28:12 +00:00
Sergey Biryukov
2190f3dc94 Build/Test Tools: Include the actual _doing_it_wrong() message or deprecation notice in the output.
This aims to provide better context and more details if an unexpected `_doing_it_wrong()` message or deprecation notice is encountered during a test run.

Previously, this would display a message like `Unexpected incorrect usage notice for [...]`, but without any further details, making it harder to track down the actual issue.

Follow-up to [25402], [25408], [25785], [37861], [51872].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53637 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-03 16:39:19 +00:00
Sergey Biryukov
242f2b0128 Docs: Add @since tags for wp_die() handlers in the PHPUnit test suite.
Follow-up to [289/tests], [28797], [41966], [53634].

See #55652, #55646.

git-svn-id: https://develop.svn.wordpress.org/trunk@53635 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-02 18:27:44 +00:00
Sergey Biryukov
3bebac5ea4 Build/Test Tools: Add support for WP_Error in the test suite's wp_die() handlers.
This brings parity with WordPress core `wp_die()` handlers and ensures that if a `WP_Error` object is passed as the `$message` argument to `wp_die()`, the PHPUnit test suite displays the error message correctly.

Previously, this would cause a silent fatal error: `Object of class WP_Error could not be converted to string`, leading to just displaying `wp_die called` without any further details.

Follow-up to [28797], [41966], [44666], [45160], [47882].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53634 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-02 18:05:32 +00:00
Sergey Biryukov
d4da924446 Editor: Alphabetize block lists in various places.
This affects:
* `wp-includes/blocks/index.php`
* `tools/webpack/blocks.js`
* `_unhook_block_registration()` in `tests/phpunit/includes/functions.php`

Follow-up to [47250], [52069], [52730], [53157], [53278].

Fixes #56131.

git-svn-id: https://develop.svn.wordpress.org/trunk@53633 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-02 17:44:46 +00:00
John Blackbourn
8622af27bb Build/Test Tools: Remove an unused build configuration file.
This is a configuration file for Apache Ant that is no longer used.

Fixes #52604


git-svn-id: https://develop.svn.wordpress.org/trunk@53629 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-01 19:54:22 +00:00
Sergey Biryukov
a0b53ac1db REST API: Add missing options to the settings endpoint.
This adds the `show_on_front`, `page_on_front`, and `page_for_posts` options to the settings endpoint that were missed during WP 6.0 backports.

Related PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/38607 #38607 Page for Posts: Display notice in template panel]

Props Mamaduka, spacedmonkey, gziolo, jameskoster.
See #56058.

git-svn-id: https://develop.svn.wordpress.org/trunk@53588 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-29 13:46:37 +00:00
Sergey Biryukov
c558823416 Tests: Remove multiple $wpdb::placeholder_escape() calls in wpdb tests.
This aims to improve performance of the tests by reducing the number of function calls.

Since `$wpdb::placeholder_escape()` saves the result in a static variable on the first run, there is no need for repeated function calls during the same request or test run, as the result would still be the same.

Follow-up to [42056].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53577 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-25 14:43:27 +00:00
David Baumwald
ac64f38b66 Database: Add %i placeholder support to $wpdb->prepare to escape table and column names.
WordPress does not currently provide an explicit method for escaping SQL table and column names. This leads to potential security vulnerabilities, and makes reviewing code for security unnecessarily difficult.  Also, static analysis tools also flag the queries as having unescaped SQL input.

Tables and column names in queries are usually in-the-raw, since using the existing `%s` will straight quote the value, making the query invalid.

This change introduces a new `%i` placeholder in `$wpdb->prepare` to properly quote table and column names using backticks.

Props tellyworth, iandunn, craigfrancis, peterwilsoncc, johnbillion, apokalyptik.
Fixes #52506.

git-svn-id: https://develop.svn.wordpress.org/trunk@53575 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-24 20:33:56 +00:00
Sergey Biryukov
2ee3444874 Tests: Replace esc_url_raw() calls with sanitize_url().
Previously committed in [53455], appears to be accidentally reverted in [53562].

Follow-up to [51597], [53452], [53455], [53562].

See #39265, #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53574 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-24 15:07:40 +00:00
Sergey Biryukov
78c315dc00 Tests: Use more consistent wording when referring to PHP deprecation notices.
Previously committed in [53492], appears to be accidentally reverted in [53564].

Follow-up to [51619], [51695], [53492], [53563].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53573 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-24 15:02:18 +00:00
Sergey Biryukov
4621347494 Tests: Give the tests for adding empty post meta values more consistent names.
One of these was previously renamed to mention `update_metadata_by_mid()`.

While `update_metadata_by_mid()` is indeed called in `wp_ajax_add_meta()` to update an existing meta value, the functionality change that the test intended to verify was in the latter function.

Follow-up to [44153], [53561].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53572 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-24 14:41:11 +00:00
Sergey Biryukov
c6ada508e6 Tests: Put @covers tags before @params in Ajax and Formatting groups.
This makes the placement more consistent with the rest of the test suite.

Follow-up to [53561], [53562].

See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53571 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-24 14:18:20 +00:00
Sergey Biryukov
984680b54e Tests: Correct the expected result for wp_ajax_replyto_comment() test with a draft post.
The "Error:" prefix was previously removed and accidentally re-added with `@covers` tags.

Follow-up to [53337], [53561].

See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53565 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-23 21:36:47 +00:00
Andrew Ozz
63560d16da Build/Test Tools: Add missing @covers tags and fix the docs for the Cron test group.
Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #39265.


git-svn-id: https://develop.svn.wordpress.org/trunk@53564 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-23 20:41:22 +00:00
Andrew Ozz
4a2c11d4fe Build/Test Tools: Fix erroneous file name, from convertInvalidEntries.php to convertInvalidEntities.php.
Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53563 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-23 20:34:26 +00:00
Andrew Ozz
5a3f8484d6 Build/Test Tools, Formatting group:
- Add and update @covers tags.
- Add and improve docs and inline comments.

Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53562 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-23 20:27:34 +00:00
Andrew Ozz
db1b341dec Build/Test Tools: Add missing @covers tags for the AJAX test group.
Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53561 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-23 19:45:24 +00:00
Aaron Jorbin
828d518988 Editor: Universalize functions for checking block editor status.
`use_block_editor_for_post_type` and `use_block_editor_for_post` can be very useful in more contexts than wp-admin, especially when a site is in transition. For example, you may want to do things on init that are different.

Neither function depends on other functions that are available only in wp-admin (other than use_block_editor_for_post() relying on use_block_editor_for_post_type() and an admin-referrer check that's historically gated by a query variable and now also gated by is_admin), therefore  moving them to wp-includes seems both feasible and beneficial

Props ethitter, jorbin.
Fixes #51819.



git-svn-id: https://develop.svn.wordpress.org/trunk@53559 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-23 18:46:18 +00:00
Sergey Biryukov
9f27d13efb Code Modernization: Remove dynamic properties in Tests_Media.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the test class contains a `set_up()` method that sets a group of properties, which are ''used'' by the tests, but never ''changed'' by the tests.

In other words, setting these properties in the `set_up()` is an unnecessary overhead and the properties should be changed to class constants.

Notes:
* As the `$img_html` property, which was previously being set, is not actually used in any of the tests, that property has not been converted to a constant.
* The values which were previously being set using a heredoc, now use a nowdoc (supported since PHP 5.3), as they don't contain any interpolation.
* The use of constant scalar expressions (`IMG_URL`) and constant arrays (`IMG_META`) in class constants is supported since PHP 5.6.

Follow-up to [711/tests], [1260/tests], [34855], [41724], [53557].

Props jrf.
See #56033.

git-svn-id: https://develop.svn.wordpress.org/trunk@53558 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-23 15:01:19 +00:00
Sergey Biryukov
bafecbeab5 Code Modernization: Remove dynamic properties in Tests_*_Slashes.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the test classes contain a `set_up()` method that sets a group of properties, which are ''used'' by the tests, but the values of these properties are never ''changed'' by the tests.

In other words, setting these properties in the `set_up()` is an unnecessary overhead and the properties should be changed to class constants.

Follow-up to [1041/tests], [1071/tests].

Props jrf.
See #56033.

git-svn-id: https://develop.svn.wordpress.org/trunk@53557 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-23 14:24:08 +00:00
Sergey Biryukov
2c11931a4a Tests: Improve the test for sticky posts not being moved to the front in sitemaps.
* Give the test method a most descriptive name.
* Use a single assertion for the URL list instead of a `foreach` loop to provide more context in case of failure.
* Add a failure message to each assertion, as there are multiple assertions used in the test.

Follow-up to [53548].

See #55633.

git-svn-id: https://develop.svn.wordpress.org/trunk@53556 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-22 16:50:14 +00:00
Jb Audras
74882538c1 Docs: Use third-person singular verbs for function descriptions in Tests_Sitemaps_wpSitemapsPosts, as per docblock standards.
See #55646.


git-svn-id: https://develop.svn.wordpress.org/trunk@53550 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-21 13:43:16 +00:00
Jonny Harris
dfcfe0b21d Posts, Post Types: Add caching to _find_post_by_old_slug and _find_post_by_old_date functions.
Cache result of database queries in `_find_post_by_old_slug` and `_find_post_by_old_date` functions. This means that repeated requests to a url where the page is not found, will result in hitting a cache for sites running persistent object caching. 

Props Spacedmonkey, dd32, mukesh27, pbearne, flixos90.
Fixes #36723.

git-svn-id: https://develop.svn.wordpress.org/trunk@53549 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-21 13:32:48 +00:00
Jb Audras
d91e148452 Sitemaps: Remove duplicate sticky Posts from Sitemap Post Query.
This changeset sets the `ignore_sticky_posts` parameter to `true` in the default arguments passed to `wp_sitemaps_posts_query_args`.

Props RavanH, pbiron, swissspidy, audrasjb, SergeyBiryukov.
Fixes #55633.


git-svn-id: https://develop.svn.wordpress.org/trunk@53548 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-21 13:16:10 +00:00
Sergey Biryukov
53372fd5be Tests: Move assertQueryTrue() closer to the other custom assertions in WP_UnitTestCase_Base.
Follow-up to [109/tests], [26005].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53545 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-21 11:12:02 +00:00
John Blackbourn
14a468294f I18N: Correct and improve inline docs and tests for functionality related to nooped plurals.
See #55646, #55652


git-svn-id: https://develop.svn.wordpress.org/trunk@53543 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-20 22:55:52 +00:00
Sergey Biryukov
268015c02d Docs: Use third-person singular verbs for function descriptions in Tests_Image_Functions, per the documentation standards.
See #55646.

git-svn-id: https://develop.svn.wordpress.org/trunk@53542 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-20 22:24:03 +00:00
Sergey Biryukov
a7f868f455 Tests: Further improve Tests_Image_Functions::test_wp_crop_image*() tests.
Includes:
* Making the test method names more specific.
* Converting one-off helper methods to static closures.
* Adding a failure message to each assertion when multiple assertions are used in the test.

Follow-up to [1126/tests], [1201/tests], [53292], [53495], [53522], [53538].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53541 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-20 22:04:24 +00:00
Sergey Biryukov
1ce3d79729 Tests: Improve Tests_Image_Functions::test_wp_crop_image*() tests.
Includes:
* Adding `@covers` annotations.
* Adding a failure message to each assertion when multiple assertions are used in the test.

Follow-up to [1126/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530], [53531], [53537].

Props jrf.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53538 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-20 21:35:03 +00:00
Sergey Biryukov
1e48121fd6 Tests: Refactor Tests_Image_Functions::test_load_directory() to split the tests and use a data provider.
This one test was testing three different situations. When one assertion fails, the rest of the test would not be executed, so this leads to hiding one error behind another.

Splitting the test into three distinct test methods still allows for testing each situation, but tests each one in isolation and won't hide errors.

The third part of the test, dealing with image editor engine classes, will also now use a data provider.

Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding `@covers` annotations.
* Adding a failure message to each assertion when multiple assertions are used in the test.
* Reusing an existing data provider with the available image editor engine classes.

Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530], [53531].

Props jrf.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53537 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-20 19:34:54 +00:00
Sergey Biryukov
397b4e45f2 Tests: Always include the error message in assertNotWPError() and assertNotIXRError().
Previously, in case of failure, `WP_UnitTestCase_Base::assertNotWPError()` displayed the actual error message from the passed `WP_Error` object, but only if the `$message` parameter was empty.

This made the assertion less helpful, as the actual error message was lost in case there was a non-empty `$message` parameter passed to the method, as per the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#using-assertions Writing PHP Tests] guidelines:
> All PHPUnit assertions, as well as all WordPress custom assertions, allow for a `$message` parameter to be passed. This message will be displayed when the assertion fails and can help immensely when debugging a test. This parameter should always be used if more than one assertion is used in a test method.

This commit ensures that the actual error message is always displayed, in addition to the passed `$message` parameter.

The same applies to `WP_UnitTestCase_Base::assertNotIXRError()`.

Follow-up to [34638], [40417].

Props jrf, SergeyBiryukov.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53536 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-20 17:27:15 +00:00
Sergey Biryukov
3813f9b2ba Tests: Use consistent punctuation in failure messages in Tests_Image_Functions.
Follow-up to [53523], [53524], [53525], [53526], [53529], [53530], [53531].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53533 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-20 12:48:35 +00:00
Sergey Biryukov
90caf2b35f Tests: Consistently check that an image was loaded in image saving tests.
Don't unnecessarily load the image twice in `test_inferred_mime_types_when_saving_an_image()`.

Follow-up to [1061/tests], [1151/tests], [1157/tests], [29834].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53532 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-19 17:26:52 +00:00