This replaces instances of `assertTrue( strpos( ... ) > 0 )` with `assertStringContainsString()` to use native PHPUnit functionality.
Going forward, these methods introduced in PHPUnit 7.5 should be used for similar assertions:
* `assertStringContainsString()`
* `assertStringNotContainsString()`
As WordPress currently uses PHPUnit 5.7.x to run tests on PHP 5.6, polyfills for these methods are now added to the `WP_UnitTestCase` class for PHPUnit < 7.5.
Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448], [51449].
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51451
git-svn-id: http://core.svn.wordpress.org/trunk@51062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`wp_autosave()` only updates drafts and auto-drafts created by the current user if the post is not locked.
As a result of previous Ajax test refactoring, setting the current user and creating a test post ended up in different methods, with the user being set after the post is already created.
This resulted in the test post being created with the `post_author` field set to zero, and the current user check in `wp_autosave()` failed. Instead of updating the original post as the test intended, it created a new autosave.
The test only passed accidentally due to `assertGreaterThanOrEqual()` not performing a strict type check.
Follow-up to [26995], [35311].
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51450
git-svn-id: http://core.svn.wordpress.org/trunk@51061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This replaces instances of `assertSame( 0, strpos( ... ) )` with `assertStringStartsWith()` to use native PHPUnit functionality.
Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448].
See #53363.
Built from https://develop.svn.wordpress.org/trunk@51449
git-svn-id: http://core.svn.wordpress.org/trunk@51060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This includes:
- Suggestion List: Check if a node exists to scroll into view.
- Autocomplete: reset state for empty text.
- Adds auxiliary class names for editor styles in the widgets editor.
- Extract snackbars into a separate component.
- Rich text: run input rules after composition end.
- iframe: load inline styles.
- Multi select: select all: restore ref callback.
- Writing flow: allow select all from empty selection.
- Post Excerpt: Fix excerpt_more filter conflict and remove wordCount attribute.
- Add the percent unit to the default units in Core.
Props desrosj.
See #53397.
Built from https://develop.svn.wordpress.org/trunk@51443
git-svn-id: http://core.svn.wordpress.org/trunk@51054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
More testing has revealed that the `image_editor_output_format` filter has some interesting edge cases that developers should be aware of when electing to use this filter (see #53667 and #53668).
Because this is a new filter that was intended to be used for experimenting with different ways to handle generating image sizes and has not yet been adopted in the wild, expanding the inline documentation is an acceptable temporary solution while these edge cases are explored further and addressed.
Props mikeschroder, antpb, desrosj, adamsilverstein, ianmjones.
See #5366, #53668, #35725.
Built from https://develop.svn.wordpress.org/trunk@51442
git-svn-id: http://core.svn.wordpress.org/trunk@51053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Upon further examination, this change was not great for backwards compatibility, resulting in block validation errors when running on older versions of WordPress.
While there are currently many `console.info()` notices caused by older format block syntax being updated to the current version included in WordPress 5.8, the blocks do not break.
Block patterns do not currently have a versioning mechanism, or a means to indicate which versions of WordPress are supported.
See #53617.
Built from https://develop.svn.wordpress.org/trunk@51434
git-svn-id: http://core.svn.wordpress.org/trunk@51045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes a bug where widgets are unintentionally moved to the `wp_inactive_widgets` sidebar when batch updates occur through the REST API.
When batch requests are processed, only `$_wp_sidebars_widgets is updated by previous calls to `WP_REST_Widgets_Controller::create_item()`. `$sidebars_widgets` is not aware of the new widget’s intended location, and `retrieve_widgets()` mistakenly flags the widget as inactive.
Calling `wp_get_sidebars_widgets()` before `retrieve_widgets()` ensures both global variables match and is intended as a temporary fix until the root cause of the problem can be fixed.
Props zieladam, htmgarcia, timothyblynjacobs.
Fixes#53657.
Built from https://develop.svn.wordpress.org/trunk@51432
git-svn-id: http://core.svn.wordpress.org/trunk@51043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This includes the following fixes:
- Safari: see if compositing layer size is more reasonable when position fixed divs are not inserted into content.
- Site Logo Block: update Site Logo block UI and option syncing.
- Fix moving inner blocks in the Widgets Customizer.
- Allow themes to provide empty values for color.duotone and spacing.units
- Update getTermsInfo() to workaround parsing issue for translatable strings.
- Specify what settings can be part of settings.layout.
- Update conditions to hide duotone panel.
- Prevent entering invalid values in the Query Loop block config.
- Prevent color panel from showing as empty.
- Avoid calling gutenberg_ functions within code shipped through WordPress Core.
Props desrosj.
See #53397.
Built from https://develop.svn.wordpress.org/trunk@51421
git-svn-id: http://core.svn.wordpress.org/trunk@51032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This provides a consistent global starting state for tests that interact with admin screens.
Individual tests no longer need to invoke `set_current_screen( 'front' )` (or an alternative implementation) as a reset.
Follow-up to [29251], [29860], [31046], [36721], [38678], [48908], [50433].
Props hellofromTonya, johnbillion.
Fixes#53431.
Built from https://develop.svn.wordpress.org/trunk@51419
git-svn-id: http://core.svn.wordpress.org/trunk@51030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This improves the consistency of test skipping and ensures that:
* The `@requires` annotations use the right condition and format, and are on the right level (class vs. function).
* Inline conditions with a `markTestSkipped()` call are only used when annotations cannot be used.
* All `markTestSkipped()` calls contain a verbose explanation of why the test is being skipped.
Props jrf, hellofromTonya.
Fixes#53009.
Built from https://develop.svn.wordpress.org/trunk@51415
git-svn-id: http://core.svn.wordpress.org/trunk@51026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Update the image links to use the CDN. Use regular text color for headings. Fix two string issues. Remove unnecessary `wp-components` script & style.
Props nao, audrasjb, karmatosed, desrosj, javiarce, milana_cap.
See #52775.
Built from https://develop.svn.wordpress.org/trunk@51413
git-svn-id: http://core.svn.wordpress.org/trunk@51024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Typo corrections in filter descriptions.
- DocBlocks are now now wrapped to the next line after 80 characters, and not extending beyond 120 total characters wide.
- Remove unnecessary repeated references to the suggested replacement hooks.
- Adjustments to the indentation for consistency with other emails in Core, allowing the `phpcs:ignore` comment to be removed.
Props SergeyBiryukov.
Fixes#44314.
Built from https://develop.svn.wordpress.org/trunk@51410
git-svn-id: http://core.svn.wordpress.org/trunk@51021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changes the references to `wp.editor` in the text widget’s JavaScript to `wp.oldEditor`, which is the new location for the old `editor` script that was previously available at `window.wp.editor`.
Follow up to [51387-51388,51390].
Props spacedmonkey, zieladam.
Fixes#53437.
Built from https://develop.svn.wordpress.org/trunk@51409
git-svn-id: http://core.svn.wordpress.org/trunk@51020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This switches `WP_REST_Sidebars_Controller` to use `wp_sidebar_description()` for retrieving the `description` of a given sidebar instead of referencing the value in the `$wp_registered_sidebars` global variable directly.
`wp_sidebar_description()` uses `wp_kses()` to only allow the default list of `$allowed_tags` to be present in a sidebar’s `description`.
Props timothyblynjacobs, desrosj.
Fixes#53646.
Built from https://develop.svn.wordpress.org/trunk@51408
git-svn-id: http://core.svn.wordpress.org/trunk@51019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This replaces instances of `assertTrue( in_array( ... ) )` with `assertContains()` to use native PHPUnit functionality.
Follow-up to [51335], [51337], [51367], [51397], [51403].
Props hellofromTonya, jrf, SergeyBiryukov.
Fixes#53123. See #53363.
Built from https://develop.svn.wordpress.org/trunk@51404
git-svn-id: http://core.svn.wordpress.org/trunk@51015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids a deprecation notice on PHP 8.1 caused by passing `null` instead of a string to `ltrim()` in `wpdb::check_safe_collation()`, and maintains the current behaviour.
Follow-up to [30345], [32162], [33455].
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51396
git-svn-id: http://core.svn.wordpress.org/trunk@51007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add missing short description for the function.
* Correct function names in `_doing_it_wrong()` calls.
* Document the usage of `$wp_scripts` and `$wp_styles` globals.
* Update syntax for multi-line comment per the documentation standards.
Follow-up to [51387], [51388].
See #53437, #53569.
Built from https://develop.svn.wordpress.org/trunk@51390
git-svn-id: http://core.svn.wordpress.org/trunk@51001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In addition to skipping animations when a related style doesn't Exist, now checks to see if animation styles are Empty as well.
This resolves a case where the Gutenberg End to End tests were failing, due to running with animations disabled.
This change should also help some users who are intentionally overriding styles to remove animations.
See https://github.com/WordPress/gutenberg/issues/32024 for the original Gutenberg issue.
Props zieladam, isabel_brison, kevin940726, desrosj, mikeschroder.
Fixes#53562.
See #53542.
Built from https://develop.svn.wordpress.org/trunk@51389
git-svn-id: http://core.svn.wordpress.org/trunk@51000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
It is common that plugins erroneously have `wp-editor` or `wp-edit-post` as a
dependency in a script that is loaded in the new widgets editor. This is a smell
since both `@wordpress/editor` and `@wordpress/edit-post` assume the existence
of a global "post" object which the widgets editor does not have.
[51387] fixes the user-facing errors typically caused by this mistake, but we
can go a step further and warn developers about this by calling
`_doing_it_wrong()` when we detect that the `wp-editor` script or `wp-edit-post`
style is enqueued alongside `wp-edit-widgets` or `wp-customize-widgets`.
See #53437.
Fixes#53569.
Props zieladam, spacedmonkey, TimothyBlynJacobs, andraganescu, dlh.
Built from https://develop.svn.wordpress.org/trunk@51388
git-svn-id: http://core.svn.wordpress.org/trunk@50999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `wp-editor` script (`@wordpress/editor` npm package) is exposed as
`window.wp.editor` in WP Admin. This causes problems, though, as many older
scripts expect to see the older `editor` script available at `window.wp.editor`.
The solution is to export all the members of the older `window.wp.editor` module
in the newer module to maintain backwards compatibility.
See #53437.
Props zieladam, spacedmonkey, TimothyBlynJacobs, andraganescu.
Built from https://develop.svn.wordpress.org/trunk@51387
git-svn-id: http://core.svn.wordpress.org/trunk@50998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit fixes an issue with the color.duotone & spacing.units in which empty values didn't override previous origins, resulting in that a theme couldn't provide an empty set for this via its theme.json.
Props nosolosw, youknowriad, aristath.
See #53175.
Built from https://develop.svn.wordpress.org/trunk@51383
git-svn-id: http://core.svn.wordpress.org/trunk@50994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
A warpper is the traditional home of a neditor. They generally are optimized for supporting the good quality content that a neditor requires to survive. Some warppers feel like they have been around forever but have laid a foundation for newer warppers. A specific Russian warppers is known for having a wide footprint and touching almost everything. Warppers were originally only found subversioned underground, but they have been able to GIT above ground in the last few years.
The number of warpers in the world is small, but without them the neditor would never survive.
See [23105], [51375], #53604.
Props SergeyBiryukov.
Built from https://develop.svn.wordpress.org/trunk@51378
git-svn-id: http://core.svn.wordpress.org/trunk@50989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When a widget is removed from a sidebar, if it was removed from the middle of the list, the widgets property would become an object with numeric keys.
The sidebars controller now forces the widgets property to be a list.
Props walbo.
Fixes#53612.
Built from https://develop.svn.wordpress.org/trunk@51377
git-svn-id: http://core.svn.wordpress.org/trunk@50988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This introduces the `excerpt_allowed_wrapper_blocks` filter for controlling which blocks should be considered wrapper blocks.
Wrapper blocks and their nested contents are not stripped by `excerpt_remove_blocks()`, allowing their contents to appear in generated excerpts.
Follow up to [51348].
Props aristath, jorbin.
See #53604.
Built from https://develop.svn.wordpress.org/trunk@51375
git-svn-id: http://core.svn.wordpress.org/trunk@50986 1a063a9b-81f0-0310-95a4-ce76da25c4cd