3906 Commits

Author SHA1 Message Date
Sergey Biryukov
22e4cb5266 Docs: Further remove tautology from comments in recurse_dirsize() tests.
Follow-up to [49212], [49616], [49628].

See #19879.

git-svn-id: https://develop.svn.wordpress.org/trunk@49630 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-17 15:48:07 +00:00
Sergey Biryukov
205c025c63 Multisite: Rename the calculate_current_dirsize filter to pre_recurse_dirsize.
Set the default value to `false`. This brings some consistency with the `pre_get_space_used` filter.

Follow-up to [49212], [49616], [49628].

See #19879.

git-svn-id: https://develop.svn.wordpress.org/trunk@49629 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-17 15:42:57 +00:00
Sergey Biryukov
025ad3469b Docs: Adjust comments for recurse_dirsize() and related tests per the documentation standards.
Follow-up to [49212], [49616].

See #19879.

git-svn-id: https://develop.svn.wordpress.org/trunk@49628 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-17 15:36:02 +00:00
Robert Anderson
ac71fffac0 Customize: Ensure multiple CSS classes are passed to nav_menu_link_attributes as an array
When multiple CSS classes are added to a menu item, the nav_menu_link_attributes
filter should be called with $item->classes set to an array of CSS class names.

When previewing in the Customizer, however, a single string was being passed to
$item->classes because WP_Customize_Nav_Menu_Item_Setting::preview() bypasses
wp_update_nav_menu_item() and instead uses filter_wp_get_nav_menu_items().

The fix is to make filter_wp_get_nav_menu_items() match what
wp_update_nav_menu_item() does and split the string into an array.

Fixes #43113.
Props dlh.


git-svn-id: https://develop.svn.wordpress.org/trunk@49624 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-17 04:29:02 +00:00
Peter Wilson
64ad8eb332 Permalinks: Prevent attachment pages 404ing following [49563].
This largely reverts [49563] due to attachment pages returning 404: File not found errors when they use the `inherit` status.

Permalink changes to attachment pages are retained when they are descendants of trashed or deleted posts.

Props Toro_Unit, helen, johnbillion, peterwilsoncc.
Fixes #51776.
See #5272.



git-svn-id: https://develop.svn.wordpress.org/trunk@49622 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-17 03:27:07 +00:00
Timothy Jacobs
ba8de96fc6 App Passwords: Unify availability language.
Previously App Passwords used a mix of "enabled" and "available". We've now standardized on using "available".

Additionally, we now use a 501 status code when indicating that App Passwords is not available.

Props SergeyBiryukov, ocean90, TimothyBlynJacobs.
Fixes #51513.


git-svn-id: https://develop.svn.wordpress.org/trunk@49617 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-16 22:40:11 +00:00
Helen Hou-Sandi
56ffe940b0 Multisite: More consistency for clean_dirsize_cache().
Props SergeyBiryukov.
Fixes #19879.


git-svn-id: https://develop.svn.wordpress.org/trunk@49616 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-16 22:29:42 +00:00
Robert Anderson
7a42314c8b Editor: Move pre_render_block, render_block_data, render_block_context
Move the pre_render_block, render_block_data, and render_block_context
filters from render_block() to WP_Block. This ensures that they are
called for all blocks, including nested blocks, not just top-level
blocks.

Fixes #51612.
Props gaambo, gziolo, TimothyBlynJacobs.


git-svn-id: https://develop.svn.wordpress.org/trunk@49608 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-16 00:45:55 +00:00
John Blackbourn
82e44bc702 Build/Test Tools: Misc test enhancements.
See #51344


git-svn-id: https://develop.svn.wordpress.org/trunk@49606 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-15 17:17:55 +00:00
John Blackbourn
cd9ed5e3ad Built/Test Tools: Switch to a data provider for the default user role and capability tests.
This test previously performed 1,010 assertions, and a failure in any one would prevent the other assertions from running. Using a data provider means simultaneous failures will all be reported at once.

See #51344, #32394


git-svn-id: https://develop.svn.wordpress.org/trunk@49605 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-15 14:57:39 +00:00
John Blackbourn
ea852af151 Build/Test Tools: Ensure user capability assertions are performed for all default roles.
The existing assertions were erroneously placed outside the iteration of all users, and therefore were only run against the last user in the list, which is the Subscriber role.

See #51344, #32394


git-svn-id: https://develop.svn.wordpress.org/trunk@49604 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-15 14:17:31 +00:00
John Blackbourn
e8435082d6 Build/Test Tools: Standardise the name, signature, and usage of the wpSetUpBeforeClass() method that's used in test classes.
This brings consistency to this often-used method, and allows IDEs to provide help to developers when using its `$factory` parameter.

See #51344


git-svn-id: https://develop.svn.wordpress.org/trunk@49603 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-15 13:59:32 +00:00
John Blackbourn
5f257b4931 Build/Test Tools: Improve the reliability of the test that ensures correct dependency order when inline scripts are used.
This test already ensures `WP_Scripts->do_concat` is true, therefore it has no dependency on `SCRIPT_DEBUG` being false. This means the test can run in an environment where the `.min` suffix is not used.

This change allows for the test to pass in this situation.

See #36392, #51734, #51344


git-svn-id: https://develop.svn.wordpress.org/trunk@49601 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-14 17:20:57 +00:00
Sergey Biryukov
9befeb00cc Build/Test Tools: Only enforce PHP extension requirements when running core tests.
This allows other users of the WordPress unit test suite framework to run their own unit tests without needing the GD extension, which should only be a requirement if running core tests.

Follow-up to [49535].

Props jamescollins.
Fixes #50640.

git-svn-id: https://develop.svn.wordpress.org/trunk@49571 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-12 17:23:44 +00:00
Sergey Biryukov
f717424287 Build/Tests Tools: Restore [49491], accidentally reverted in [49566].
See #39210.

git-svn-id: https://develop.svn.wordpress.org/trunk@49570 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-12 17:13:56 +00:00
Sergey Biryukov
fd3ef484ec Build/Tests Tools: Restore [49535], accidentally reverted in [49566].
See #39210.

git-svn-id: https://develop.svn.wordpress.org/trunk@49569 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-12 17:06:48 +00:00
Dominik Schilling
4006c07417 I18N: Revert [49236] for now to investigate alternative implementations.
See #39210, #51678, #26511.

git-svn-id: https://develop.svn.wordpress.org/trunk@49566 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-12 14:41:19 +00:00
Peter Wilson
8b2aa594e3 Canonical: Prevent ID enumeration of private post slugs.
Add check to `redirect_canonical()` to ensure the destination post is not using a private post status.

Props dd32, Denis-de-Bernardy, donmhico, helen, nacin, peterwilsoncc, pishmishy, TimothyBlynJacobs, tzafrir, Viper007Bond, whyisjake.
Fixes #5272.



git-svn-id: https://develop.svn.wordpress.org/trunk@49563 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-12 04:14:44 +00:00
Helen Hou-Sandi
2a7d1e2394 Editor: Display short description from block directory in results.
Props dd32, ryelle.
Fixes #51212.


git-svn-id: https://develop.svn.wordpress.org/trunk@49559 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-10 20:24:38 +00:00
Andrew Ozz
60516115ed Tests QUnit: Remove restriction on running the TinyMCE Textpattern WP plugin tests in PhantomJS.
Props @desrosj.
Fixes #42009.

git-svn-id: https://develop.svn.wordpress.org/trunk@49556 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-10 09:16:53 +00:00
Jonathan Desrosiers
92c6723c24 Tests: Remove duplicate fields key in WP_Query test.
Introduced in [46188].

See #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@49554 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-09 23:39:25 +00:00
Jonathan Desrosiers
a85803a7ba Build/Test Tools: Remove PHP >= 5.3 check.
WordPress no longer supports PHP < 5.6.20. This check is no longer necessary.

Fixes #51737.

git-svn-id: https://develop.svn.wordpress.org/trunk@49551 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-09 19:40:41 +00:00
Sergey Biryukov
4eee0d2fb7 Tests: Use assertSame() in some newly introduced tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.

Follow-up to [48937], [48939], [48940], [48944].

See #38266.

git-svn-id: https://develop.svn.wordpress.org/trunk@49547 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-09 15:43:14 +00:00
John Blackbourn
e4f47125ab Media: Restore the ability of WP_Image_Editor_Imagick->save() to create a missing directory when needed.
Props eemitch, mikeschroder, hellofromTonya, p00ya, johnbillion

Fixes #51665


git-svn-id: https://develop.svn.wordpress.org/trunk@49542 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-09 13:16:54 +00:00
Sergey Biryukov
31831c74d9 Networks and Sites: Assign the array of site or network data returned from filters to the respective class property:
* The array of network data returned from the `networks_pre_query` filter is assigned to the `networks` property of the current `WP_Network_Query` instance.
* The array of site data returned from the `sites_pre_query` filter is assigned to the `sites` property of the current `WP_Site_Query` instance.

This avoids the performance overhead of calling `WP_Network_Query::get_networks()` or `WP_Site_Query::get_sites()` twice: first when creating the object instance, then to retrieve the filtered results.

This also makes the filters a bit more consistent with other similar filters, e.g. `posts_pre_query`, `terms_pre_query`, `comments_pre_query`, or `users_pre_query`.

Follow-up to [46086], [48990].

Props yakimun, spacedmonkey.
Fixes #51333.

git-svn-id: https://develop.svn.wordpress.org/trunk@49538 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-08 11:45:36 +00:00
Sergey Biryukov
f2302a3112 Build/Test Tools: Check if all the required PHP extensions are loaded before running the test suite.
Add the GD extension as a hard requirement.

This improves the reliability of the test suite and ensures that if the test infrastructure changes in the future and a platform requirement such as GD accidentally gets removed, the tests fail with an appropriate error message.

Follow-up to [48592].

Props ayeshrajans, jrf, johnbillion.
Fixes #50640.

git-svn-id: https://develop.svn.wordpress.org/trunk@49535 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-07 13:18:24 +00:00
Jonathan Desrosiers
4ddaf4b5df Build/Test Tools: Disable update attempts while running unit tests.
This fixes an issue introduced in [49369] that causes l10n related tests to fail when the PHPUnit test suite is run multiple times without hints of the site being under version control.

[49369] removed the `.git` folder from the ZIP artifact created during the initial setup job. This ZIP file is used by the later jobs in the workflow that run the test suite. The absence of the `.git` folder in these later jobs caused the language packs initially loaded from `phpunit/data/languages` folder to be updated asynchronously, resulting in unexpected values when running the tests a second time.

This change disables all Core auto-update and asynchronous language pack update attempts when running PHPUnit tests.

Props ocean90, SergeyBiryukov.
See #50401.
Fixes #51670.

git-svn-id: https://develop.svn.wordpress.org/trunk@49491 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-03 21:07:33 +00:00
John Blackbourn
8fffa6c243 Tests: Remove some useless assertions from the image editor tests.
In each of these instances the variable being tested is a directly instantiated object and can never be a `WP_Error`, unlike when `wp_get_image_editor()` is used.

See #51344


git-svn-id: https://develop.svn.wordpress.org/trunk@49488 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-03 15:50:51 +00:00
Helen Hou-Sandi
9d356ed8d9 Remove accidentally duplicated code introduced in [49475].
See #46536.


git-svn-id: https://develop.svn.wordpress.org/trunk@49476 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-02 19:07:29 +00:00
Helen Hou-Sandi
140b29db87 Privacy: More precise checking of user request action names.
Props garrett-eclipse.
Fixes #46536.


git-svn-id: https://develop.svn.wordpress.org/trunk@49475 602fd350-edb4-49c9-b593-d223f7449a82
2020-11-02 18:40:06 +00:00
Peter Wilson
088fd3cd39 Taxonomy: Revert Light-weight/partial term counts.
Partial revert of [49141], [49171], [49316].

All functional changes are removed, appropriate term counting unit tests are retained.

See #40351.


git-svn-id: https://develop.svn.wordpress.org/trunk@49451 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-30 04:57:16 +00:00
Sergey Biryukov
bba3c98cec Tests: Remove the GLOB_BRACE flag for glob() function from unit tests.
The flag was previously used in PDF preview tests when cleaning up temporary files.

As noted in the PHP documentation, the flag is not available on some non-GNU systems, like Solaris or Alpine Linux.

Follow-up to [40130].

Props amykamala, sawanoboly.
Fixes #51661.

git-svn-id: https://develop.svn.wordpress.org/trunk@49450 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-30 02:01:33 +00:00
Jonathan Desrosiers
d5ddd6d4be Meta: Sanitize meta key before checking protection status.
Props zieladam, peterwilsoncc, xknown, whyisjake.
Merges [49377,49381] to trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@49387 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-29 18:05:21 +00:00
Jonathan Desrosiers
4cbb155815 Embeds: Disable embeds on deactivated Multisite sites.
Props xknown, whyisjake, zieladam, peterwilsoncc.
Merges [49374] to trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@49383 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-29 17:59:40 +00:00
Jonathan Desrosiers
add6bedf3a External Libraries: Disable deserialization in Requests_Utility_FilteredIterator
Props xknown, peterwilsoncc, desrosj, dd32, whyisjake.
Merges [49373] to trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@49382 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-29 17:58:49 +00:00
Jonathan Desrosiers
c9e6b98968 XML-RPC: Improve error messages for unprivileged users.
Add specific permission checks to avoid ambiguous failure messages.

Props zieladam, peterwilsoncc, xknown, whyisjake.

git-svn-id: https://develop.svn.wordpress.org/trunk@49380 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-29 17:42:13 +00:00
Sergey Biryukov
6b2f57da36 REST API: Remove accidentally duplicated key in test fixtures.
Follow-up to [49334], [49368].

See #51638.

git-svn-id: https://develop.svn.wordpress.org/trunk@49370 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-29 01:32:52 +00:00
Sergey Biryukov
df716454a3 REST API: Regenerate test fixtures after [49334].
Props garrett-eclipse.
Fixes #51638.

git-svn-id: https://develop.svn.wordpress.org/trunk@49368 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-29 01:00:12 +00:00
Sergey Biryukov
75bb139087 Tests: Correct post formats registration in WP_REST_Search_Controller tests.
When declaring theme support for the `post-formats` feature, an array of supported post formats needs to be specified.

Follow-up to [49344], [49354].

Props garrett-eclipse.
Fixes #51390.

git-svn-id: https://develop.svn.wordpress.org/trunk@49365 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-29 00:02:00 +00:00
Sergey Biryukov
4f6eee8e72 Themes: Move the test for post-formats theme support to a more appropriate place.
Follow-up to [49344].

See #51390.

git-svn-id: https://develop.svn.wordpress.org/trunk@49354 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-28 15:12:40 +00:00
Helen Hou-Sandi
357c1c0b86 Post Formats: You have to pass an array of supported post formats.
This shows a `_doing_it_wrong()` message and also returns false instead of true if no array of formats is passed in `add_theme_support()`, avoiding a PHP error.

Post formats maintainership comes full circle. 🙃

Props Mista-Flo, sproutchris, garrett-eclipse.
Fixes #51390.


git-svn-id: https://develop.svn.wordpress.org/trunk@49344 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-27 19:58:10 +00:00
Timothy Jacobs
0187bbdd7e Site Health, App Passwords: Test if the Authorization header is populated correctly.
App Passwords rely on the Authorization header to transport the Basic Auth credentials. For Apache web servers, WordPress automatically includes a RewriteRule to populate the value for servers running in CGI or FastCGI that wouldn't ordinarily populate the value. 

This tests if the header is being filled with the expected values. For Apache users, we direct the user to visit the Permalinks settings to flush their permalinks. For all other users, we direct them to a help document on developer.wordpress.org.

Props Clorith, marybaum, TimothyBlynJacobs.
Fixes #51638.


git-svn-id: https://develop.svn.wordpress.org/trunk@49334 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-27 18:30:03 +00:00
Timothy Jacobs
d56906f5b0 REST API: Support a broader range of JSON media types.
Previously, we only supported `application/json` which prevented using subtypes like `application/activity+json`. This allows for the REST API to `json_decode` the body of requests using a JSON subtype `Content-Type`. Additionally, `wp_die()` now properly sends the error as JSON when a JSON subtype is specified in the `Accept` header.

Props pfefferle.
Fixes #49404.


git-svn-id: https://develop.svn.wordpress.org/trunk@49329 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-27 16:42:38 +00:00
Sergey Biryukov
fce8f2bf4d Posts, Post Types: Check if taxonomy is set for the tax_input parameter of wp_insert_post().
This avoids a PHP notice when creating a post with multiple taxonomies both having a default term.

Props yakimun, szaqal21, hareesh-pillai, audrasjb.
Fixes #51320.

git-svn-id: https://develop.svn.wordpress.org/trunk@49328 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-27 16:40:35 +00:00
Sergey Biryukov
986becfd4d Tests: Rename some files and classes in phpunit/tests/post/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780].

See #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@49327 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-27 16:07:21 +00:00
Riad Benguella
dda3adec97 Block Editor: Update the WordPress packages for 5.6 beta 2
It contains:

- Fix drop zone indicators for non blocks.
- Fix archives block render function.
- Code block: preserve indentation on paste.
- Turn off autocomplete for token input. 
- Fix parent post selector: ensure initial value available, search performed, all results shown. 
- Fix gallery block undo issue.

Props isabel_brison.
Fixes #51640.


git-svn-id: https://develop.svn.wordpress.org/trunk@49324 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-27 09:32:50 +00:00
Riad Benguella
7be4701404 Block Editor: Fix WP_Block_Supports class compatibility with Gutenberg-provided class.
When using WordPress trunk with Gutenberg master, there's an incompatibility causing 
the dynamic block generated classes to be omitted.
This commit refactors the block supports to fix that problem.

Props nosolosw.
Fixes #51606.


git-svn-id: https://develop.svn.wordpress.org/trunk@49310 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-26 08:29:04 +00:00
Sergey Biryukov
111ebad65e Tests: Correct newly introduced @covers tags.
When global functions are covered, they need to be prefixed with `::` (double colon) to distinguish them from class name.

See https://phpunit.readthedocs.io/en/7.0/annotations.html#covers for more details.

Follow-up to [49000], [49171].

Props jrf.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@49305 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-25 00:31:12 +00:00
Timothy Jacobs
1e030c4062 REST API, XML-RPC: Synchronise empty comment content checks.
The REST API and XML-RPC now uses the same detection methodology for empty comment content as `wp_handle_comment_submission()`. Specifically, comments now have their content trimmed and '0' is allowed.

Props jaswrks, rmccue, dd32, rachelbaker, Cawa-93, aduth, TimothyBlynJacobs.
Fixes #43177.


git-svn-id: https://develop.svn.wordpress.org/trunk@49303 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-24 22:44:38 +00:00
Timothy Jacobs
e66f459435 REST API: Don't validate status if it hasn't changed.
In particular, this allows for sending `status=inherit` to an attachment if it's current status is `inherit`. This status would be rejected because it is an "internal" post status which isn't exposed.

As a general rule, a developer should always be able to PUT back a GET response without error.

Props dfenton, pputzer, TimothyBlynJacobs.
Fixes #40399.



git-svn-id: https://develop.svn.wordpress.org/trunk@49302 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-24 16:02:34 +00:00