Sergey Biryukov
d9346ea967
Tests: Check if image metadata for a particular size was successfully retrieved in some media tests.
...
This outputs a proper message in case of failure, instead of an obscure PHP error further in the test.
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@49032
git-svn-id: http://core.svn.wordpress.org/trunk@48794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-22 12:32:07 +00:00
TimothyBlynJacobs
883ace38f1
REST API: Regenerate test fixtures after [48982].
...
Props garrett-eclipse.
Fixes #50805 .
Built from https://develop.svn.wordpress.org/trunk@49031
git-svn-id: http://core.svn.wordpress.org/trunk@48793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 22:54:06 +00:00
Sergey Biryukov
5d99107bf3
Tests: Fix typo in some `markTestSkipped()` messages.
...
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@49030
git-svn-id: http://core.svn.wordpress.org/trunk@48792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 20:20:07 +00:00
John Blackbourn
175c2c5b7c
Users: Introduce the `invited_user_email` filter for filtering the contents of the email sent when an existing user is invited to a site on Multisite.
...
Props contact-banker, anand.au14, nikolam, johnbillion
Fixes #42132
Built from https://develop.svn.wordpress.org/trunk@49029
git-svn-id: http://core.svn.wordpress.org/trunk@48791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 17:16:07 +00:00
John Blackbourn
aef504acfd
Docs: Correct the indentation for some array type docs.
...
See #50768
Built from https://develop.svn.wordpress.org/trunk@49028
git-svn-id: http://core.svn.wordpress.org/trunk@48790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 16:46:06 +00:00
Sergey Biryukov
790983eca4
Tests: Use consistent trailing punctuation in `markTestSkipped()` messages.
...
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@49027
git-svn-id: http://core.svn.wordpress.org/trunk@48789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 14:07:05 +00:00
Sergey Biryukov
29c0edfbba
Privacy: Check if the accumulated data in `wp_privacy_process_personal_data_export_page()` is not empty.
...
This avoids an error on PHP 8 caused by passing an empty string to `array_merge()`, instead of an array.
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@49026
git-svn-id: http://core.svn.wordpress.org/trunk@48788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 13:51:03 +00:00
Sergey Biryukov
a95e9a91da
Tests: Convert a few more `function_exists()` and `extension_loaded()` checks to `@requires` annotations.
...
This better utilizes the PHPUnit native functionality.
Follow-up to [49024].
See #50639 , #50640 .
Built from https://develop.svn.wordpress.org/trunk@49025
git-svn-id: http://core.svn.wordpress.org/trunk@48787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 13:27:02 +00:00
Sergey Biryukov
1e39e21616
Tests: Convert the checks for `imagejpeg()` function availability to use the `@requires` annotation.
...
This better utilizes the PHPUnit native functionality.
Props ayeshrajans, jrf, johnbillion.
Fixes #50639 . See #50640 .
Built from https://develop.svn.wordpress.org/trunk@49024
git-svn-id: http://core.svn.wordpress.org/trunk@48786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 11:36:04 +00:00
Sergey Biryukov
6e5ca746e1
General: Give the `$is` variable in `is_wp_error()` a more descriptive name.
...
Follow-up to [49022].
See #40568 .
Built from https://develop.svn.wordpress.org/trunk@49023
git-svn-id: http://core.svn.wordpress.org/trunk@48785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 11:13:05 +00:00
John Blackbourn
964d0784be
General: Introduce the `wp_error_added` and `wp_error_checked` actions.
...
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
2020-09-20 17:44:07 +00:00
John Blackbourn
aba2165aae
Media: Standardise the description for image size parameters.
...
This brings continuity to all the image related functions and filters which accept or pass a size parameter.
Props dilipbheda, johnbillion
Fixes #47364
Built from https://develop.svn.wordpress.org/trunk@49021
git-svn-id: http://core.svn.wordpress.org/trunk@48783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 16:23:07 +00:00
John Blackbourn
0b2e31a7f8
Docs: Inline documentation improvements for media related functions and hooks.
...
See #47364 , #50768
Built from https://develop.svn.wordpress.org/trunk@49020
git-svn-id: http://core.svn.wordpress.org/trunk@48782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 15:55:10 +00:00
Sergey Biryukov
2884b7b1b7
Media: Return a `WP_Error` from `WP_Image_Editor_GD::load()` if file contents could not be retrieved.
...
This avoids an error on PHP 8 caused by calling `imagecreatefromstring()` on an empty result.
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@49019
git-svn-id: http://core.svn.wordpress.org/trunk@48781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 14:28:05 +00:00
Sergey Biryukov
8752dbaaba
Tests: Correctly unset non-supported image editor engines in some image tests.
...
Follow-up to [49009], [49014].
See #50639 , #50640 .
Built from https://develop.svn.wordpress.org/trunk@49018
git-svn-id: http://core.svn.wordpress.org/trunk@48780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 14:15:03 +00:00
John Blackbourn
43b11121de
Media: Correct some types for attachment ID parameters passed to functions and filters.
...
See #47364 , #50768
Built from https://develop.svn.wordpress.org/trunk@49017
git-svn-id: http://core.svn.wordpress.org/trunk@48779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 14:05:05 +00:00
John Blackbourn
e22107ce4e
Media: Correct some types in docblocks for filters related to thumbnails.
...
Props dilipbheda
See #47364 , #50768
Built from https://develop.svn.wordpress.org/trunk@49016
git-svn-id: http://core.svn.wordpress.org/trunk@48778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:40:04 +00:00
Sergey Biryukov
e6fd778208
Tests: Use more specific assertions in `Tests_Image_Functions::test_load_directory()`.
...
This avoids an error on PHP 8 caused by calling `get_resource_type()` on a string.
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@49015
git-svn-id: http://core.svn.wordpress.org/trunk@48777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:33:04 +00:00
Sergey Biryukov
a29b071f80
Tests: Optimize some image tests to avoid checking for image editor engines availability twice.
...
Follow-up to [49009].
See #50639 , #50640 .
Built from https://develop.svn.wordpress.org/trunk@49014
git-svn-id: http://core.svn.wordpress.org/trunk@48776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:27:05 +00:00
John Blackbourn
7d61c45afc
I18N: Add a language icon next to the Default Language network option.
...
Fixes #51359
Built from https://develop.svn.wordpress.org/trunk@49013
git-svn-id: http://core.svn.wordpress.org/trunk@48775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:18:05 +00:00
John Blackbourn
ecfff6fe80
Media: Correct the image thumbnail logic in media templates.
...
This ensures the correct data properties are checked before displaying image thumbnails.
Props chetan200891
Fixes #49655
Built from https://develop.svn.wordpress.org/trunk@49012
git-svn-id: http://core.svn.wordpress.org/trunk@48774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 13:15:04 +00:00
John Blackbourn
123806ff28
Themes: Remove the ability to delete themes from the single site Appearance screen on Multisite installations.
...
This brings theme deletion inline with plugin deletion and theme and plugin editing, which can only be performed from within Network Admin.
Props Mista-Flo, williampatton, johnbillion
Fixes #41441
Built from https://develop.svn.wordpress.org/trunk@49011
git-svn-id: http://core.svn.wordpress.org/trunk@48773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 12:03:05 +00:00
Sergey Biryukov
e8f35359d7
Tests: Consistently require `imagejpeg()` function in `image_make_intermediate_size()` tests.
...
This outputs a proper message if the requirement is not met, instead of an obscure PHP error further in the test.
See #50639 , #50640 .
Built from https://develop.svn.wordpress.org/trunk@49010
git-svn-id: http://core.svn.wordpress.org/trunk@48772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 03:33:05 +00:00
Sergey Biryukov
795e4ebd31
Tests: Skip some image tests if neither GD nor Imagick image editor engines are supported on the system.
...
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
2020-09-20 02:47:05 +00:00
Sergey Biryukov
8791de899a
Coding Standards: Fix WPCS issue in [49007].
...
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@49008
git-svn-id: http://core.svn.wordpress.org/trunk@48770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 01:18:04 +00:00
Sergey Biryukov
9e3b5d2f12
Tests: Fix the failures in REST API `format` keyword validation tests on PHP 8.
...
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
2020-09-20 00:57:06 +00:00
Sergey Biryukov
4ae2bafafd
Tests: Add missing `@covers` tags for files in `phpunit/tests/functions/`.
...
Props pbearne, jrf.
See #39265 .
Built from https://develop.svn.wordpress.org/trunk@49006
git-svn-id: http://core.svn.wordpress.org/trunk@48768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 15:54:03 +00:00
Sergey Biryukov
9bb4b76044
Tests: Speed up slashed data tests by reusing some more shared fixtures.
...
Follow-up to [35249], [49003].
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@49005
git-svn-id: http://core.svn.wordpress.org/trunk@48767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 11:12:04 +00:00
Sergey Biryukov
b27ebaa269
Coding Standards: Give the `$id` variable in slashed data tests a more descriptive name.
...
See #50767 , #51344 .
Built from https://develop.svn.wordpress.org/trunk@49004
git-svn-id: http://core.svn.wordpress.org/trunk@48766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 10:55:05 +00:00
Sergey Biryukov
54fe0e0698
Tests: Speed up slashed data tests by reusing shared fixtures.
...
Follow-up to [35249].
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@49003
git-svn-id: http://core.svn.wordpress.org/trunk@48765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 10:36:03 +00:00
Sergey Biryukov
c50c266e51
Tests: Speed up tests for `wp_allow_comment()` by reusing shared fixtures.
...
Props frank-klein.
Fixes #51216 .
Built from https://develop.svn.wordpress.org/trunk@49002
git-svn-id: http://core.svn.wordpress.org/trunk@48764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 09:27:06 +00:00
Sergey Biryukov
f2a2ffbf2c
Tests: Simplify the logic in `WP_UnitTestCase_Base::setUpBeforeClass()` and `::tearDownAfterClass()`.
...
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@49001
git-svn-id: http://core.svn.wordpress.org/trunk@48763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 09:13:07 +00:00
Peter Wilson
b1505c2d9c
Posts, Post Types: Ensure default terms are added by `wp_publish_post()`.
...
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
2020-09-19 01:22:08 +00:00
Sergey Biryukov
88ea2929b7
Tests: Simplify `PluralFormsTest::test_exceptions()`.
...
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
2020-09-18 14:13:03 +00:00
Sergey Biryukov
0e0c620dee
Docs: Update the code example in `WP_Ajax_UnitTestCase::dieHandler()` DocBlock to use `expectException()`.
...
Follow-up to [48996], [48997].
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@48998
git-svn-id: http://core.svn.wordpress.org/trunk@48760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 13:55:04 +00:00
Sergey Biryukov
b69db72a08
Tests: Switch Ajax tests to use the `expectException()` method directly, instead of the `WP_UnitTestCase_Base::setExpectedException()` wrapper.
...
This brings some consistency with other tests.
Follow-up to [48996].
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@48997
git-svn-id: http://core.svn.wordpress.org/trunk@48759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 13:50:04 +00:00
Sergey Biryukov
e42779f9a0
Tests: Consistently use the `expectException()` method instead of the older `@expectedException` annotation.
...
See https://thephp.cc/news/2016/02/questioning-phpunit-best-practices
The method is available since PHPUnit 5.2, and WordPress currently supports PHPUnit 5.4 as the minimum version.
Follow-up to [48993].
See #51344 .
Built from https://develop.svn.wordpress.org/trunk@48996
git-svn-id: http://core.svn.wordpress.org/trunk@48758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 13:24:07 +00:00
Sergey Biryukov
68d3c5ca56
Docs: Add a `@since` note about `adjacent_posts_rel_link_wp_head()` no longer being used in core.
...
Follow-up to [48966].
Props jnylen0.
See #39111 .
Built from https://develop.svn.wordpress.org/trunk@48995
git-svn-id: http://core.svn.wordpress.org/trunk@48757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 11:06:04 +00:00
Sergey Biryukov
0cdab6e91d
Docs: Add a `@since` note for the `recovery_mode_email` filter about the `$email` argument now including the `attachments` key.
...
Follow-up to [48964].
See #51276 .
Built from https://develop.svn.wordpress.org/trunk@48994
git-svn-id: http://core.svn.wordpress.org/trunk@48756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 11:03:02 +00:00
Sergey Biryukov
6f4de5f31a
Tests: Fix the failure in `test_get_weekday_undefined_index()` on PHP 8.
...
The test ensures that `WP_Locale::get_weekday()` throws an "undefined offset" notice when called with an incorrect `$weekday_number` parameter.
In PHP 8, that notice is now a warning, so the test needs to be adjusted accordingly.
See #50913 .
Built from https://develop.svn.wordpress.org/trunk@48993
git-svn-id: http://core.svn.wordpress.org/trunk@48755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 10:58:03 +00:00
Sergey Biryukov
ddefc9ee9a
Twenty Twenty: Update the URL for PHP date formats table in translator comments.
...
Follow-up to [48991].
Props hareesh-pillai, mukesh27, iandunn.
Fixes #51335 . See #51332 .
Built from https://develop.svn.wordpress.org/trunk@48992
git-svn-id: http://core.svn.wordpress.org/trunk@48754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 10:44:04 +00:00
Sergey Biryukov
d5b8d282e8
Docs: Update the URL for PHP date formats table in translator comments.
...
Props hareesh-pillai, iandunn.
Fixes #51332 .
Built from https://develop.svn.wordpress.org/trunk@48991
git-svn-id: http://core.svn.wordpress.org/trunk@48753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-18 10:37:08 +00:00
Sergey Biryukov
e1a05a42d3
Comments: Assign the array of comment data returned from the `comments_pre_query` filter to the `comments` property of the current `WP_Comment_Query` instance.
...
This avoids the performance overhead of calling `WP_Comment_Query::get_comments()` twice: first when creating the object instance, then to retrieve the filtered results.
This also makes the filter a bit more consistent with other similar filters, e.g. `posts_pre_query`, `terms_pre_query`, or `users_pre_query`.
Follow-up to [46086].
Props dinhtungdu, imath, spacedmonkey, adamsilverstein, SergeyBiryukov.
Fixes #50521 .
Built from https://develop.svn.wordpress.org/trunk@48990
git-svn-id: http://core.svn.wordpress.org/trunk@48752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 19:55:08 +00:00
antpb
541796de46
Media: Allow contextually generated images to show in Media Library grid view.
...
In grid view, contextually generated or cropped media is filtered out causing page numbering to be offset and incorrect. This also impacted any media utilizing `media-models.js`.
Props webmandesign, audrasjb, afercia, pbiron, mista-flo.
Fixes #46127 , #50410 , #47215 .
Built from https://develop.svn.wordpress.org/trunk@48989
git-svn-id: http://core.svn.wordpress.org/trunk@48751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 14:42:04 +00:00
Sergey Biryukov
359119a31e
Tests: Move the `data_wp_site_query_meta_query()` data provider next to the test it's used in.
...
See #50767 .
Built from https://develop.svn.wordpress.org/trunk@48988
git-svn-id: http://core.svn.wordpress.org/trunk@48750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 11:30:02 +00:00
Sergey Biryukov
226dc9fc2c
Docs: Correct comments in `comments_pre_query`, `networks_pre_query`, and `sites_pre_query` tests.
...
Follow-up to [44983], [46086].
See #50768 .
Built from https://develop.svn.wordpress.org/trunk@48987
git-svn-id: http://core.svn.wordpress.org/trunk@48749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 11:20:04 +00:00
Sergey Biryukov
e01409866e
Docs: Reformat `comments_pre_query`, `networks_pre_query`, `sites_pre_query` DocBlocks for better readability.
...
See #50768 .
Built from https://develop.svn.wordpress.org/trunk@48986
git-svn-id: http://core.svn.wordpress.org/trunk@48748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 11:10:03 +00:00
Sergey Biryukov
b66ff2f68d
Docs: Fix typo in `*_pre_query` filter DocBlocks.
...
See #50768 .
Built from https://develop.svn.wordpress.org/trunk@48985
git-svn-id: http://core.svn.wordpress.org/trunk@48747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:45:03 +00:00
Sergey Biryukov
06e53b90a1
Docs: Correct the parameter type for `networks_pre_query` filter.
...
The filter should return the network count as an integer if `$this->query_vars['count']` is set.
Follow-up to [46100].
See #50768 , #47599 .
Built from https://develop.svn.wordpress.org/trunk@48984
git-svn-id: http://core.svn.wordpress.org/trunk@48746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:37:05 +00:00
Sergey Biryukov
ac00862f44
Formatting: Make sure `links_add_target()` adds the `target` attribute to the correct tag.
...
Previously, the attribute could unintentionally be added to a tag that starts with the same characters, e.g. `<aside>` instead of `<a>`.
Props antonlukin.
Fixes #51313 .
Built from https://develop.svn.wordpress.org/trunk@48983
git-svn-id: http://core.svn.wordpress.org/trunk@48745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:14:07 +00:00