Introduced in [48242], the `link-manager` plugin is copied from `DIR_TESTDATA/plugins` to `DIR_TESTDATA` during the REST API unit tests, but was not cleaned up afterward. This created a "dirty" local working copy. This change `unlink`s the copied plugin from `DIR_TESTDATA` after unit tests are completed.
Props johnbillion, TimothyBlynJacobs, desrosj, rachelbaker.
Fixes#52579.
git-svn-id: https://develop.svn.wordpress.org/trunk@50633 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a fatal error on PHP 8 in `wp_privacy_generate_personal_data_export_file()` if the `_export_data_grouped` post meta exists but is not an array.
Additionally, refactor unit tests for the function to:
* Reduce redundant code
* Switch to data provider
* Test on the full HTML output instead of select pieces of the output
* Expand unhappy path coverage
Follow-up to [43012], [44786], [47146], [47278].
Props hellofromTonya, jrf, xknown.
See #51423.
git-svn-id: https://develop.svn.wordpress.org/trunk@50613 602fd350-edb4-49c9-b593-d223f7449a82
This was added in [48177] to fix an issue where Puppeteer was not being installed correctly as a dependency of `@wordpress/wp-scripts`. This has been fixed, so this explicit dependency can be removed.
Props isabel_brison, desrosj, SergeyBiryukov.
Fixes#52843.
git-svn-id: https://develop.svn.wordpress.org/trunk@50612 602fd350-edb4-49c9-b593-d223f7449a82
Since [50441-50442] switched the test workflows to run from `src` instead of `build`, code coverage reporting has stopped working. This was caused by the code coverage configuration continuing to reference `build`. This corrects the configuration so coverage reporting can resume.
This change also introduces the `workflow_dispatch` event to the workflow, which will allow committers to manually run the workflow when desired. For example, to confirm changes to the test suite do not break reporting.
This also adds the `phpunit.xml.dist` and `tests/phpunit/multisite.xml` files to the `paths` list. Since these files are responsible for configuring the test suite and code coverage reporting, any changes to them should verify that no problems were introduced.
Props jrf, johnbillion.
Fixes#52786. See #51734.
git-svn-id: https://develop.svn.wordpress.org/trunk@50592 602fd350-edb4-49c9-b593-d223f7449a82
Add a check to `WP_REST_Meta_Fields::delete_meta_value()` ensuring meta data is set before attempting to delete it from the database. If the data does not exist, the delete is considered successful as the data matches the desired state.
Props BrechtVds, goaroundagain, TimothyBlynJacobs.
Fixes#52787.
git-svn-id: https://develop.svn.wordpress.org/trunk@50567 602fd350-edb4-49c9-b593-d223f7449a82
Removes the mutually exclusive directives check in `wp_robots()`, ie allow both `follow` and `nofollow` to be specified and for `archive` and `noarchive` to be specified.
This fixes a bug in which WordPress would defer to the most permissive over the least permissive. When contradictory instructions are included, WordPress will defer to the search engine's or archivist's resolution policy: generally this is to observe the least, not most permissive.
Props Cybr, flixos90.
Fixes#52713.
git-svn-id: https://develop.svn.wordpress.org/trunk@50566 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a "Trying to access array offset on value of type bool" PHP warning in `get_term_link()` if the `$rewrite` parameter of `register_taxonomy()` is set as `false`.
Props Tkama, SergeyBiryukov.
Fixes#52882.
git-svn-id: https://develop.svn.wordpress.org/trunk@50565 602fd350-edb4-49c9-b593-d223f7449a82
The E2E workflow is failing after this change. Reverting to to investigate further.
Unprops desrosj.
See #52843.
git-svn-id: https://develop.svn.wordpress.org/trunk@50542 602fd350-edb4-49c9-b593-d223f7449a82
This was added in [48177] to fix an issue where Puppeteer was not being installed correctly as a dependency of `@wordpress/wp-scripts`. This has been fixed, so this explicit dependency can be removed.
Props isabel_brison.
Fixes#52843.
git-svn-id: https://develop.svn.wordpress.org/trunk@50540 602fd350-edb4-49c9-b593-d223f7449a82
Update @wordpress npm packages to the latest published versions. This includes
block editor bug fixes for WordPress 5.7 RC 3.
See #52718.
git-svn-id: https://develop.svn.wordpress.org/trunk@50496 602fd350-edb4-49c9-b593-d223f7449a82
Ensure `current_user_can()` and `user_can()` return the same results for logged out users. For core capabilities this changes `user_can( 0, 'exist' )` to return `true` rather than `false` in line with `current_user_can( 'exist' )` for logged out users.
Convert `current_user_can()` and `current_user_can_for_blog()` to wrapper functions ultimately calling `user_can()`.
Add anonymous user to primitive capability checks as appropriate. Convert `Tests_User_Capabilities::test_other_caps_for_all_roles()` to use a data provider and add tests to check whether user exists in the database (`WP_User::exists()`) as that intentionally differs from the `exist` capability.
Props jjj, johnbillion, peterwilsoncc, SergeyBiryukov, TimothyBlynJacobs.
Fixes#52076.
git-svn-id: https://develop.svn.wordpress.org/trunk@50490 602fd350-edb4-49c9-b593-d223f7449a82
This changes the logic in `update_https_detection_errors()` to never store error messages from the actual request since they could use a different encoding, which would make storing them in an option potentially fail, leading WordPress to then falsely assume that HTTPS is supported.
While this doesn't actually fix the encoding issue, it is not crucial to do so anyway, since these messages are not used anywhere. A simple differentiation between whether the overall HTTPS request or only the SSL verification failed should be sufficient for the purpose of this function.
Props flixos90, tmatsuur, lukecarbis.
Fixes#52484.
git-svn-id: https://develop.svn.wordpress.org/trunk@50471 602fd350-edb4-49c9-b593-d223f7449a82
The parent methods should always be called before any test-specific functionality is set up, unless there is a specific and documented reason.
See #52625
git-svn-id: https://develop.svn.wordpress.org/trunk@50449 602fd350-edb4-49c9-b593-d223f7449a82
Some PHPUnit tests were concerned with the state of files in the `build` directory. In order to allow the tests to run without requiring a build to be run first, these have been moved into assertions that run after the build step (and therefore cause it to fail if they do not pass), or into QUnit tests as necessary.
Various other PHPUnit tests implictly depend on built JavaScript files being present. These files are now touched during the test setup to avoid PHP warnings if the `build` files are not present.
The `wp-tests-config-sample.php` file and the GitHub Actions configuration have also been changed so `ABSPATH` uses `src` instead of `build`, therefore allowing the PHPUnit tests to be run without a build having to be run first. This means all new local installations of WordPress will use `src` for PHPUnit testing. If you would like to switch your existing installation over then change the location of `ABSPATH` in `wp-tests-config.php` to point to `src` instead of `build`.
Props peterwilsoncc, iandunn, gziolo, desroj, johnbillion
Fixes#51734
See #45863
git-svn-id: https://develop.svn.wordpress.org/trunk@50441 602fd350-edb4-49c9-b593-d223f7449a82
This avoids polluting other tests and allows the `ms-excluded` test group to successfully run on its own.
Props johnbillion, SergeyBiryukov.
See #52607.
git-svn-id: https://develop.svn.wordpress.org/trunk@50433 602fd350-edb4-49c9-b593-d223f7449a82
Move `wp_get_script_tag()`, `wp_print_script_tag()`, `wp_print_inline_script_tag()` and `wp_get_inline_script_tag()` functions from `functions.php` to `script-loader.php`.
Relocate related tests to `dependencies` sub-directory.
Follow up to [50167].
Props adamsilverstein, hellofromTonya, SergeyBiryukov.
Fixes#39941.
git-svn-id: https://develop.svn.wordpress.org/trunk@50409 602fd350-edb4-49c9-b593-d223f7449a82
Prevent `wp_localize_script()` (via `WP_Scripts::localize()`) throwing warnings in PHP 8 when the translation data is passed as a string. This maintains backward compatibility with earlier versions of PHP.
Introduce a `_doing_it_wrong()` notice to `WP_Scripts::localize()` if the translation data is not passed as an array.
Props jrf, peterwilsoncc, SergeyBiryukov.
Fixes#52534.
git-svn-id: https://develop.svn.wordpress.org/trunk@50408 602fd350-edb4-49c9-b593-d223f7449a82
Previously, only posts with the `publish` status could be embedded.
Props goaroundagain, peterwilsoncc, poena.
Fixes#47574.
git-svn-id: https://develop.svn.wordpress.org/trunk@50401 602fd350-edb4-49c9-b593-d223f7449a82
Prior to this changeset, the check for the correct RSD link output was relying on a specific protocol, although it needs to accept both the HTTP and HTTPS version of the URL.
Props TimothyBlynJacobs.
Fixes#52542. See #47577.
git-svn-id: https://develop.svn.wordpress.org/trunk@50391 602fd350-edb4-49c9-b593-d223f7449a82
Ensure that subsequent renders of a reusable block will render correctly and that recursively inserting a reusable block into itself does not cause an internal server (500) error.
Props bernhard-reiter, SergeyBiryukov.
Fixes#52364.
git-svn-id: https://develop.svn.wordpress.org/trunk@50382 602fd350-edb4-49c9-b593-d223f7449a82
In `unstick_post()` if a post ID is duplicated in the `sticky_posts` option remove all instances.
In both `stick_post()` and `unstick_post()` check for duplicate IDs already stored in the `sticky_post` option and remove them if the option is updated.
Props rahmohn, archon810.
Fixes#52007.
git-svn-id: https://develop.svn.wordpress.org/trunk@50380 602fd350-edb4-49c9-b593-d223f7449a82