44545 Commits

Author SHA1 Message Date
John Blackbourn
ad9de4547c REST API: Correct the order of the parameters documented for WP_REST_Server::respond_to_request().
See #53399


git-svn-id: https://develop.svn.wordpress.org/trunk@51915 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-18 11:13:32 +00:00
Sergey Biryukov
d802fecf97 Coding Standards: Consistently escape form action URL in wp-admin/update-core.php.
Follow-up to [10166], [23739], [25806].

Props sabbirshouvo, mukesh27.
Fixes #54278.

git-svn-id: https://develop.svn.wordpress.org/trunk@51914 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-17 20:29:58 +00:00
Sergey Biryukov
d36e2dd621 Docs: Improve documentation for the tax_input parameter of wp_insert_post().
Follow-up to [10222], [13217], [33922].

Props dingo_d.
Fixes #54264.

git-svn-id: https://develop.svn.wordpress.org/trunk@51913 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-16 02:37:39 +00:00
Tonya Mork
0a0e8159a8 FileSystem API: Add safeguard for invalid return from get_attached_file() in wp_delete_attachment().
The `get_attached_file()` function is supposed to return the path to the file, but could:
1. Return `false` if the file doesn't exist.
2. Return literally anything else, as a filter is being applied to the value on return.

As the `clean_dirsize_cache()` now has input validation, passing anything but a non-empty string to `clean_dirsize_cache()` will result in a PHP error notice.

This was exposed by the `Tests_Post_GetPostStatus::wpSetUpBeforeClass()` method which started generating unexpected output (the doing it wrong message) during the test run.

While this indicates that there is a flaw in the mocking being done in the test suite, debugging that is outside of the scope of the current patch.

At the same time, as based on the above point, this ''could'' potentially happen in a real-world situation as well, adding additional conditions to the `if` in the `wp_delete_attachment()` function before calling the `clean_dirsize_cache()` function, is warranted.

As there are no tests for the `wp_delete_attachment()` function at all at this time, we're not adding a test specifically for this change for now. This should however be addressed in the future, when tests will be added to cover the `wp_delete_attachment()` function completely. 

Follow-up to [32619], [49212], [51910].

Props jrf, hellofromTonya.
See #52241.

git-svn-id: https://develop.svn.wordpress.org/trunk@51912 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-15 22:57:47 +00:00
Tonya Mork
f180a0865e FileSystem API: Fix autovivification deprecation notice in recurse_dirsize().
>PHP natively allows for autovivification (auto-creation of arrays from falsey values). This feature is very useful and used in a lot of PHP projects, especially if the variable is undefined. However, there is a little oddity that allows creating an array from a `false` and `null` value.

The above quote is from the PHP 8.1 RFC and the (accepted) RFC changes the behaviour described above to deprecated auto creation of arrays from `false`. As it is deprecated, it _will_ still work for the time being, but as of PHP 9.0, this will become a Fatal Error, so we may as well fix it now.

The `recurse_dirsize()` function retrieves a transient and places it in the `$directory_cache` variable, but the `get_transient()` function in WP returns `false` when the transient doesn't exist, which subsequently can lead to the above mentioned deprecation notice.

By verifying that the `$directory_cache` variable is an array before assigning to it and initializing it to an empty array, if it's not, we prevent the deprecation notice, as well as harden the function against potentially corrupted transients where this transient would not return the expected array format, but some other variable type.

Includes adding dedicated unit tests for both the PHP 8.1 issue, as well as the hardening against corrupted transients.

Includes some girl-scouting: touching up a parameter description and some code layout.

Refs:
* https://wiki.php.net/rfc/autovivification_false
* https://developer.wordpress.org/reference/functions/get_transient/

Follow-up to [49212], [49744].

Props jrf, hellofromTonya.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51911 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-15 22:52:43 +00:00
Tonya Mork
dce6abe768 FileSystem API: Fix infinite loop on Windows for clean_dirsize_cache().
When the PHP native `dirname()` function is used on a Windows disk name - i.e. `C:\`-, it will return the same, i.e, it will return `C:\` again.

The `clean_dirsize_cache()` function didn't have guard clause against this, which meant that on Windows based systems and IIS servers, this function would result in WordPress getting stuck into an infinite loop.

The adjustment to the `while` part of the function fix this by checking if the return value of the `dirname()` function call is the same as the original path passed to `dirname()`, which effectively fixes the infinite loop.

A number of other improvements made:

1. Add input validation for the `$path` parameter to guard against invalid variable types being passed into the function.

2. Guard against an empty `$path` parameter, which would result in an infinite loop on both Windows as well as *nix based systems.

In both these cases, a PHP notice will now be thrown.

3. When a non-empty string, which isn't a path would previously be passed, the `dirname()` function would transform that to a `.` and the `.` key in the transient cache would be cleared out.
This was a bug as there is no relation between a non-path string and the root directory of file system.

This bug has been fixed by checking that something could actually be a path and handling received non-empty, non-path input parameters in a special way, i.e only removing the cache key for the passed string and bowing out from further processing.

Unfortunately, no tests can be added to guard against the infinite loop.

For the other fixes, we have added appropriate unit tests. 

Follow-up up [49212], [49616], [49744].

Props jrf, hellofromTonya, raubvogel, sergeybiryukov, codezen8, sjlevy, drosmog, teachlynx, ekojr, bartoszgrzesik, joegasper, janthiel, josephdickson, ocean90, audrasjb.
Fixes #52241.

git-svn-id: https://develop.svn.wordpress.org/trunk@51910 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-15 22:23:35 +00:00
Gary Pendergast
0800c31518 Embeds: Add Wolfram Notebook as a trusted oEmbed provider.
Fixes #53326.



git-svn-id: https://develop.svn.wordpress.org/trunk@51909 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-15 05:03:17 +00:00
Rachel Baker
66ed91d214 REST API: Add text-field and textarea-field as available schema formats for string sanitization.
Props ocean90, TimothyBlynJacobs.
Fixes #49960.

git-svn-id: https://develop.svn.wordpress.org/trunk@51908 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-15 02:03:38 +00:00
Sergey Biryukov
dc54ceabd8 Media: Display the unsaved changes dialog in image edit form using jQuery .text() function.
This ensures that HTML entities like non-breaking spaces are properly displayed instead of being encoded.

Props jdy68, sebastienserre, audrasjb, mukesh27, SergeyBiryukov.
Fixes #54232.

git-svn-id: https://develop.svn.wordpress.org/trunk@51907 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-15 00:17:49 +00:00
Sergey Biryukov
ef20d5fdbe Docs: Update WP_Date_Query documentation to reflect changes in accepted column names.
Remove outdated list of accepted column name values, add a reference to `WP_Date_Query::validate_column()` and the `date_query_valid_columns` filter instead for a more detailed description.

Follow-up to [25139], [25860], [29933], [29934], [29938], [37477], [51905].

Props dimadin, johnjamesjacoby.
Fixes #54248.

git-svn-id: https://develop.svn.wordpress.org/trunk@51906 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-14 18:03:07 +00:00
Sergey Biryukov
04044f9aa5 Docs: Update documentation for the date_query_valid_columns filter.
Add a `@since` note for `registered` and `last_updated` as default recognized date query columns. 

Follow-up to [25139], [25860], [29933], [29934], [29938], [37477].

Props dimadin, johnjamesjacoby.
See #54248.

git-svn-id: https://develop.svn.wordpress.org/trunk@51905 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-13 19:58:35 +00:00
Tonya Mork
65d9094a47 Build/Test Tools: Add end-to-end (e2e) tests README.md.
Adds a readme to the `/tests/e2e/` folder to provide (a) instructions of how to run the tests locally and (b) links to documentation.

Follow-up to [45570].

Props isabel_brison, desrosj, justinahinon.
Fixes #53550.

git-svn-id: https://develop.svn.wordpress.org/trunk@51904 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-12 18:50:34 +00:00
Sergey Biryukov
d96e75674b I18N: Add context for some Media Library filter strings:
* Audio
* Video
* Unattached

This allows for more homogeneous translations in languages where keeping a plural form is important.

Follow-up to [6910], [7397], [8901], [9556], [11749], [13100], [12110], [15491], [15578], [22743], [29426], [29625], [34256], [45651], [46437].

Props jdy68, audrasjb, SergeyBiryukov.
Fixes #54238.

git-svn-id: https://develop.svn.wordpress.org/trunk@51903 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-12 16:42:19 +00:00
Sergey Biryukov
1227fc5119 Upgrade/Install: Restore or clean up the temporary plugin or theme backup on shutdown.
This allows these actions to run ''after'' the main process, without affecting the update. Actions running on `shutdown` are immune to PHP timeouts, so in case the failure was due to a PHP timeout, we'll still be able to properly restore the previous version.

Follow-up to [51815], [51898], [51899].

Props aristath, peterwilsoncc.
See #54166.

git-svn-id: https://develop.svn.wordpress.org/trunk@51902 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-11 15:07:52 +00:00
Sergey Biryukov
6367c01844 External Libraries: Revert [51900] for now to investigate test failures.
See #54162.

git-svn-id: https://develop.svn.wordpress.org/trunk@51901 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-10 01:15:16 +00:00
Sergey Biryukov
267b0717ec External Libraries: Update getID3 to version 1.9.21.
The latest version includes preliminary PHP 8.1 support, as well as a variety of bug fixes.

Release notes: https://github.com/JamesHeinrich/getID3/releases/tag/v1.9.21

A full list of changes in this update can be found on GitHub:
https://github.com/JamesHeinrich/getID3/compare/v1.9.20...v1.9.21

This commit also includes PHPCS adjustments previously made for a passing PHP Compatibility scan.

Follow-up to [47601], [47737], [47902], [48278], [49621], [50714].

Props jrf, SergeyBiryukov.
Fixes #54162.

git-svn-id: https://develop.svn.wordpress.org/trunk@51900 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-10 00:12:03 +00:00
Sergey Biryukov
184e7c15ed Upgrade/Install: Introduce a move_dir() function.
This replaces the `copy_dir()` usage in `WP_Upgrader::install_package()` and aims to avoid PHP timeout issues when installing or updating large plugins on slower systems like Vagrant or the WP Docker test environment.

The new function attempts a native PHP `rename()` function first and falls back to the previous `copy_dir()`.

Follow-up to [51815], [51898].

Props afragen, aristath, peterwilsoncc, galbaras, noisysocks, pbiron.
Fixes #54166. See #51857.

git-svn-id: https://develop.svn.wordpress.org/trunk@51899 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-09 03:37:41 +00:00
Sergey Biryukov
4b60c38a36 Site Health: Use an integer value as a fallback in the available disk space check.
This avoids a few type problems further in the code: boolean divided by a number, or passing `false` to `size_format()` which is documented to accept integers or strings only.

Follow-up to [51815].

Props TobiasBg.
See #51857.

git-svn-id: https://develop.svn.wordpress.org/trunk@51898 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-09 02:49:02 +00:00
Andrew Ozz
92ff897931 External Libraries: Update jQuery UI to 1.13.0 final.
Props Clorith, mgol, azaozz.
Fixes #52163.

git-svn-id: https://develop.svn.wordpress.org/trunk@51897 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-08 18:04:08 +00:00
Sergey Biryukov
440336b73e Taxonomy: Populate the WP_Terms_List_Table::$items property in ::prepare_items().
This allows the parent `WP_List_Table::has_items()` method to work as expected, and the override in the child class can now be removed. It also makes the class more consistent with other list table classes.

As a result of this change, the "Bulk actions" dropdown is no longer unnecessarily displayed if there are no terms.

Follow-up to [15491], [17025], [17026].

Props mattoakley, swissspidy, audrasjb, SergeyBiryukov.
Fixes #54181.

git-svn-id: https://develop.svn.wordpress.org/trunk@51896 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-08 00:36:18 +00:00
Sergey Biryukov
eda09eccfb Docs: Add a @since note for the new $parent_block parameter of several filters:
* `pre_render_block`
* `render_block_data`
* `render_block_context`

Follow-up to [51894].

See #51612.

git-svn-id: https://develop.svn.wordpress.org/trunk@51895 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-07 13:14:43 +00:00
Andrew Ozz
ed9f437fc0 Apply the pre_render_block, render_block_data, and render_block_context filters when rendering inner/nested blocks. Introdices another param to these filters: $parent_block that is the "parent" WP_Block instance for nested blocks and null for top level blocks. Adds unit tests for the filters.
Props noisysocks, gaambo, azaozz.
Fixes #51612.

git-svn-id: https://develop.svn.wordpress.org/trunk@51894 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-06 18:47:09 +00:00
Sergey Biryukov
411eaea04f Twenty Twenty-One: Remove duplicate width and height values from social icons.
These values are added dynamically by the `Twenty_Twenty_One_SVG_Icons::get_svg()` method and are not needed in the source array.

Follow-up to [49216].

Props max-dayala, laxman-prajapati, sabernhardt, Presskopp, mukesh27.
Fixes #54208.

git-svn-id: https://develop.svn.wordpress.org/trunk@51893 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-06 15:37:36 +00:00
Tonya Mork
83b2339a0e Permalinks: Move the Nginx documentation link to help sidebar in wp-admin/options-permalink.php.
The "Documentation on Nginx configuration." link is out of place being below the "Save Changes" button on the Settings > Permalinks UI.

This commit relocates the link to join the other support related content links in the help tab's "For more information:" right sidebar area.

Follow-up to [34691], [45674].

Props audrasjb, hellofromTonya, johnjamesjacoby, mukesh27, peterwilsoncc, timlappe.
Fixes #39258.

git-svn-id: https://develop.svn.wordpress.org/trunk@51892 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-05 23:09:21 +00:00
Sergey Biryukov
a86f7c7def Accessibility: Privacy: Use red color for action buttons on the Erase Personal Data screen:
* "Erase Personal Data" button in the Next Steps column.
* "Force Erase Personal Data" row action.

This highlights the destructive nature of those buttons to avoid an accidental erasure, and is consistent with other similar UI elements in the admin, e.g. various "Delete", "Spam", or "Trash" buttons.

Props arena, sabernhardt, carike, azaozz, joedolson, audrasjb, SergeyBiryukov.
Fixes #49603.

git-svn-id: https://develop.svn.wordpress.org/trunk@51891 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-05 20:30:11 +00:00
Jonathan Desrosiers
be25c1bf25 Build/Test Tools: Change the patch version used for testing the 5.6 branch of PHP.
This unpins the version of PHP 5.6.20 used when testing the 5.6 branch of PHP.

Using 5.6.20 was an intentional decision in [49162], as that patch version is the oldest version of PHP 5.6 still supported by WordPress. However, as of September 30, 2021, the `5.6.20` image contains a version of OpenSSL with an expired certificate, sometimes resulting in an expired trust chain.

Props Clorith, hellofromTonya, SergeyBiryukov, desrosj.
Merges [51889] to `trunk`.
Fixes #54223.

git-svn-id: https://develop.svn.wordpress.org/trunk@51890 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-05 17:33:11 +00:00
Tonya Mork
374adaafe6 Coding Standards: Use strict type check for in_array() in register_block_script_handle().
Follow-up to [51501].

Props aristath, sergeybiryukov.
Fixes #54206. See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51888 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-05 16:51:15 +00:00
Tonya Mork
f2d146d3f1 Administration: Allow plugin action links row to wrap.
When there are several action links or the text for these links is long, the plugin name column's width extends causing the other columns to shrink in width. This case is a less than desirable user experience.

The plugin name's column has `white-space: nowrap` (on larger screens). This commit changes the `white-space` to `normal`, allowing the plugin action links row to wrap into more than one line.

Follow-up to [41695].

Props ankit-k-gupta, nekojonez, sabernhardt, sergeybiryukov.
Fixes #53275.

git-svn-id: https://develop.svn.wordpress.org/trunk@51887 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-05 15:05:15 +00:00
John Blackbourn
de822e8fb0 Docs: Improve various inline documentation for admin bar functions and hooks.
Props audrasjb

See #53399


git-svn-id: https://develop.svn.wordpress.org/trunk@51886 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-04 20:45:36 +00:00
John Blackbourn
4bf908449a Docs: Miscellaneous inline documentation improvements, including:
* Document the post statuses global as an array of `stdClass` objects
* Document the taxonomies global as an array of `WP_Taxonomy` objects
* Document the return value of the post count functions as `stdClass` objects
* Fix some typos

See #53399


git-svn-id: https://develop.svn.wordpress.org/trunk@51885 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-04 20:42:54 +00:00
Sergey Biryukov
c69c34273a Build/Test Tools: Update the @wordress/e2e-test-utils package to version 5.4.3.
This is needed in order to use the [7a33cd43a2/packages/e2e-test-utils/src/rest-api.js REST API functions] implemented in a recent version in Core e2e tests.

Props justinahinon.
Fixes #54215.

git-svn-id: https://develop.svn.wordpress.org/trunk@51884 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-04 11:44:49 +00:00
Sergey Biryukov
3ae66a3cd1 HTTP: Remove the DST Root CA X3 certificate expired on September 30, 2021.
> The currently recommended certificate chain as presented to Let’s Encrypt ACME clients when new certificates are issued contains an intermediate certificate (ISRG Root X1) that is signed by an old DST Root CA X3 certificate that expires on 2021-09-30. In some cases the OpenSSL 1.0.2 version will regard the certificates issued by the Let’s Encrypt CA as having an expired trust chain.
> 
> Most up-to-date CA cert trusted bundles, as provided by operating systems, contain this soon-to-be-expired certificate. The current CA cert bundles also contain an ISRG Root X1 self-signed certificate. This means that clients verifying certificate chains can find the alternative non-expired path to the ISRG Root X1 self-signed certificate in their trust store.
> 
> Unfortunately this does not apply to OpenSSL 1.0.2 which always prefers the untrusted chain and if that chain contains a path that leads to an expired trusted root certificate (DST Root CA X3), it will be selected for the certificate verification and the expiration will be reported.

References:
* [https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/ Old Let’s Encrypt Root Certificate Expiration and OpenSSL 1.0.2]
* [https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/ DST Root CA X3 Expiration (September 2021)]

Follow-up to [25224], [25426], [25569], [27307], [30491], [30765], [34283], [35919], [36570], [46094].

Props bradleyt, fierevere.
Fixes #54207. See #50828.

git-svn-id: https://develop.svn.wordpress.org/trunk@51883 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-03 17:50:01 +00:00
Timothy Jacobs
6194de49dc REST API: Sort widget types by their id.
Fixes #53303.
Props spacedmonkey.


git-svn-id: https://develop.svn.wordpress.org/trunk@51882 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-02 21:43:26 +00:00
Sergey Biryukov
f660632c9c Twenty Twenty-One: Keep the closing </span> tag in footer links.
When the `link_after` value is emptied to reset any description markup, make sure not to remove the closing tag within footer links.

Follow-up to [49216].

Props sabernhardt, mukesh27.
Fixes #54209.

git-svn-id: https://develop.svn.wordpress.org/trunk@51881 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-02 17:04:52 +00:00
Tonya Mork
1f0aed81a6 Administration: Enable first and last page buttons in WP_List_Table::pagination().
Previously the first and last page pagination buttons were disabled when on their next or previous page respectively. This commit removes that unnecessary logic to keep these buttons enabled and avoid confusion in the user's navigation workflow. 

New behavior:
- When on page 2, the go to first page `«` button is enabled
- When on the page before the last page, the go to last page `»` button is enabled

Follow-up to [32948], [47219].

Props wp_kc, ronakganatra, knutsp, sabernhardt, Hareesh Pillai, audrasjb, hellofromTonya.
Fixes #42763.

git-svn-id: https://develop.svn.wordpress.org/trunk@51880 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-01 18:38:52 +00:00
Sergey Biryukov
4226e71828 Coding Standards: Use strict comparison in wp-includes/class-wp-http-ixr-client.php.
Follow-up to [16064], [16871], [17928].

See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51879 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-01 14:59:31 +00:00
Tonya Mork
f6755ded9f App Passwords: Remove placeholder from the app password name input field.
In [49294, 49752], the `placeholder` attribute changed to `"WordPress App on My Phone"`. This change causes confusion as the field can be used in a variety of ways and is not limited to a phone.

Given a label exists for each field and clearly identifies its purpose, this commit removes the `placeholder` attribute from the `input` field.

Follow-up to [49109], [49294], [49752].

Props seedsca, audrasjb, joedolson, rehanali.
Fixes #54047.

git-svn-id: https://develop.svn.wordpress.org/trunk@51878 602fd350-edb4-49c9-b593-d223f7449a82
2021-10-01 13:47:59 +00:00
Sergey Biryukov
48c68e5dac Coding Standards: Use strict comparison in wp-includes/class-http.php.
Follow-up to [10625], [10864], [13274], [29661], [33748], [47508], [47808].

See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51877 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-30 14:03:17 +00:00
Sergey Biryukov
2bcff1d6a2 Docs: Improve documentation for WP_Admin_Bar methods.
Add some missing descriptions and `@since` tags.

Follow-up to [15671], [19120], [19429], [19501], [19558], [25475], [25478], [25563], [32534], [35157], [40947], [45821], [48826].

Props yagniksangani, hellofromTonya, audrasjb, sabernhardt, mukesh27, rehanali, SergeyBiryukov.
Fixes #54191.

git-svn-id: https://develop.svn.wordpress.org/trunk@51876 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-29 13:38:21 +00:00
Sergey Biryukov
48f2966c95 Twenty Twenty-One: Remove duplicate class name from localized font-family elements.
Follow-up to [46613], [49216], [51874].

Props tmatsuur, aezazshekh.
See #54196.

git-svn-id: https://develop.svn.wordpress.org/trunk@51875 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-28 10:01:33 +00:00
Sergey Biryukov
ab501af2b5 Twenty Twenty: Remove duplicate class name from localized font-family elements.
Follow-up to [46613].

Props tmatsuur, aezazshekh.
Fixes #54196.

git-svn-id: https://develop.svn.wordpress.org/trunk@51874 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-28 09:59:48 +00:00
Sergey Biryukov
863b9f0f8b Coding Standards: Remove duplicate assignment from a ternary operator in WP_MS_Sites_List_Table::site_states().
Adjust similar code in `_post_states()` and `_media_states()` for consistency.

Follow-up to:
* [12897], [15491], [32755], [46153], [48424] for `WP_MS_Sites_List_Table::site_states()`.
* [17793], [47775], [49223] for `_media_states()`.
* [9153], [46309] for `_post_states()`.

Props joelcj91, audrasjb, desrosj.
Fixes #38296.

git-svn-id: https://develop.svn.wordpress.org/trunk@51873 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-27 00:35:38 +00:00
Sergey Biryukov
90b6ae9943 Tests: Update the Services_JSON test for PHPUnit 9.5.10/8.5.21+.
Since PHPUnit 9.5.10 and 8.5.21, PHP deprecations are no longer converted to exceptions by default (`convertDeprecationsToExceptions="true"` can be configured to enable this).

Reference: [fac02620f6 Do not convert PHP deprecations to exceptions by default]; [https://github.com/sebastianbergmann/phpunit/blob/9.5.10/ChangeLog-9.5.md#9510---2021-09-25 PHPUnit 9.5.10 changelog].

With this change, the test for the `Services_JSON` compat class started failing:
{{{
There was 1 failure:

1) Tests_Compat_jsonEncodeDecode::test_json_encode_decode
Failed asserting that exception of type "PHPUnit\Framework\Error\Deprecated" is thrown.
}}}

This converts the native PHPUnit `::expectDeprecation()` method call in the test to a set of individual WP-specific `::setExpectedDeprecated()` method calls in order to not depend on PHPUnit behavior that is no longer the default.

Additionally, this commit includes support for catching deprecation notices from `_deprecated_file()` function calls to the `WP_UnitTestCase_Base::expectDeprecated()` method.

Follow-up to [46205], [46625], [48996], [51563], [51852], [51871].

Props jrf, netweb, SergeyBiryukov.
See #54183, #54029, #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51872 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-26 03:27:10 +00:00
Sergey Biryukov
7c2b54e027 Build/Test Tools: Update PHPUnit configuration for PHPUnit 9.5.10/8.5.21+.
Since PHPUnit 9.5.10 and 8.5.21, PHP deprecations are no longer converted to exceptions by default (`convertDeprecationsToExceptions="true"` can be configured to enable this).

Reference: [fac02620f6 Do not convert PHP deprecations to exceptions by default]; [https://github.com/sebastianbergmann/phpunit/blob/9.5.10/ChangeLog-9.5.md#9510---2021-09-25 PHPUnit 9.5.10 changelog].

Let's unpack this:

Previously (PHPUnit < 9.5.10/8.5.21), if PHPUnit would encounter a PHP native deprecation notice, it would:
1. Show a test which causes a deprecation notice to be thrown as **"errored"**,
2. Show the **first** deprecation notice it encountered and
3. PHPUnit would exit with a **non-0 exit code** (2), which will fail a CI build.

As of PHPUnit 9.5.10/8.5.21, if PHPUnit encounters a PHP native deprecation notice, it will no longer do so. Instead PHPUnit will:
1. Show a test which causes a PHP deprecation notice to be thrown as **"risky"**,
2. Show the **all** deprecation notices it encountered and
3. PHPUnit will exit with a **0 exit code**, which will show a CI build as passing.

This commit reverts PHPUnit to the previous behaviour by adding `convertDeprecationsToExceptions="true"` to the PHPUnit configuration. It also adds the other related directives for consistency.

Props jrf, netweb, costdev, SergeyBiryukov.
See #54183.

git-svn-id: https://develop.svn.wordpress.org/trunk@51871 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-26 03:11:18 +00:00
Sergey Biryukov
e0359da2c1 Tests: Don't skip some Ajax tests on multisite, add them to the ms-excluded group instead.
Follow-up to [46693], [49835].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51870 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-26 00:12:56 +00:00
Sergey Biryukov
364dfec369 Tests: Remove unnecessary setUp() and tearDown() methods in multisite tests.
These were originally added in [26252] to suppress database errors on `setUp()` and restore on `tearDown()` for tests that call `wpmu_create_blog()`, blog factory, or installation code that attempts to clear transients.

As the multisite test coverage expanded, these methods ended up being unnecessarily copied into other test classes, where database error suppression is not required.

Follow-up to [26252], [29916], [30286], [33184], [34898], [34899], [34901], [37234], [37477], [37894], [49212], [49616], [51859].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51869 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-25 01:27:47 +00:00
Tonya Mork
284764c658 Build/Test Tools: Remove the PHPUnit container from local Docker environment.
This commit:

* Removes the PHPUnit `wordpressdevelop/phpunit` container as a service to the Docker environment.
* Updates `test:php` (the default way to run tests) to run the Composer PHPUnit package  default.
* Removes the `test:php-composer` script.

There is no longer a need for core to keep the `wordpressdevelop/phpunit` container as a service in `docker-compose.yml`. Removing it will reduce the overhead and bandwidth needed to set up WordPress locally and remove confusion about its use.

Follow-up to [45783-45784], [49099], [49362], [51545], [51736], [51685].

Props johnbillion, hellofromTonya.
Fixes #54112.

git-svn-id: https://develop.svn.wordpress.org/trunk@51868 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-24 16:54:42 +00:00
Sergey Biryukov
3546c694e9 Tests: Rename classes in phpunit/tests/multisite/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646], [51650], [51651].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51860 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-24 00:45:43 +00:00
Sergey Biryukov
80a345f5b2 Tests: Further improve the tests for avoid_blog_page_permalink_collision():
* Rename the test filename and class to match the name of the function being tested.
* Remove unnecessary `setUp()` and `tearDown()` methods.
* Replace the `only` test group with `post`.

Follow-up to [51855-51857].

See #51147.

git-svn-id: https://develop.svn.wordpress.org/trunk@51859 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-24 00:29:46 +00:00
Sergey Biryukov
a12706381b Tests: Correct the @ticket reference in wp_terms_checklist() tests.
Follow-up to [48880].

See #53363, #51137.

git-svn-id: https://develop.svn.wordpress.org/trunk@51858 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-24 00:12:47 +00:00