The `Block_Supported_Styles_Test` class is not a `TestCase` to be extended, but an actual concrete test class. In order to run as expected, it should be placed under `phpunit/tests/blocks/` along with the other block tests.
Additionally:
* Add missing visibility keywords to test methods.
* Update the expected results to the currently used format for the tests to pass.
* Remove two outdated tests. The functionality being tested there is no longer available in this manner, so these tests are redundant.
Follow-up to [49226], [49310].
Props jrf, aristath, youknowriad.
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51490 602fd350-edb4-49c9-b593-d223f7449a82
Version bump three bundled themes to avoid file not found and fatal errors introduced for child themes during the 5.8 release cycle.
* Twenty Ten: Version 3.5 (fatal error & 404)
* Twenty Eleven: Version 3.9 (404)
* Twenty Twelve: Version 3.5 (404)
These updates will be released mid 5.8.1 cycle due to the severity of the issues.
Follow up to [51482,51483].
Props dd32, peterwilsoncc.
Fixes#53777.
git-svn-id: https://develop.svn.wordpress.org/trunk@51486 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a "Division by zero" PHP warning if a plugin changes the `posts_per_page` value to zero.
Follow-up to [51145].
Props 2linctools, kapilpaul, audrasjb.
Fixes#53773.
git-svn-id: https://develop.svn.wordpress.org/trunk@51485 602fd350-edb4-49c9-b593-d223f7449a82
By using `get_template_directory_uri()` instead of `get_stylesheet_directory_uri()`, we make sure to include the images from the parent theme.
This avoids displaying missing images in block patterns when using a child theme of Twenty Ten, Twenty Eleven, or Twenty Twelve.
Follow-up to [51033], [51103], [51106].
Props audrasjb.
Fixes#53769.
git-svn-id: https://develop.svn.wordpress.org/trunk@51483 602fd350-edb4-49c9-b593-d223f7449a82
By using `get_template_directory()` instead of `get_stylesheet_directory()`, we make sure to include the `block-patterns.php` file from the parent theme.
This avoids a PHP fatal error when using a child theme of Twenty Ten.
Follow-up to [51106].
Props ryelle, sabernhardt, loranrendel.
Fixes#53752.
git-svn-id: https://develop.svn.wordpress.org/trunk@51482 602fd350-edb4-49c9-b593-d223f7449a82
* Check if the object attribute exists before checking its value.
* Mention the field name in error messages in case of failure.
Follow-up to [51478], [51479], [51480].
Props jrf.
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51481 602fd350-edb4-49c9-b593-d223f7449a82
* Use `assertSame()` instead of `fail()` to display a proper message in case of failure.
* Add an optional `$message` parameter for consistency with other assertions.
Follow-up to [51478], [51479].
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51480 602fd350-edb4-49c9-b593-d223f7449a82
All assertions in PHPUnit have a `$message` parameter. Setting this parameter allows to distinguish which assertion is failing when a test runs multiple assertions, making debugging of the tests easier.
This optional parameter is now added for the assertion methods in the `WP_UnitTestCase_Base` class that were missing it.
Props jrf.
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51478 602fd350-edb4-49c9-b593-d223f7449a82
A concrete test class should be suffixed with `Test`, not `UnitTestCase(s)`.
Follow-up to [25053].
Props jrf.
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51476 602fd350-edb4-49c9-b593-d223f7449a82
This should make it clear that the variable is used as part of the HTML `<title>` tag on admin screens.
Props ravipatel, hellofromTonya, sabernhardt, audrasjb, SergeyBiryukov.
Fixes#53729.
git-svn-id: https://develop.svn.wordpress.org/trunk@51475 602fd350-edb4-49c9-b593-d223f7449a82
While this has no effect on void elements in HTML5, it fixes a minor inconsistency with the rest of core.
Follow-up to [47493], [48834], [50556], [51418].
Props radixweb, ankitmaru, TobiasBg, sabernhardt, audrasjb.
Fixes#53716.
git-svn-id: https://develop.svn.wordpress.org/trunk@51473 602fd350-edb4-49c9-b593-d223f7449a82
Related issue in Gutenberg: https://github.com/WordPress/gutenberg/issues/33552
The loop in WP_Theme_JSON_Resolver to extract translatable paths was broken, as it contained an immediate and unconditional return. This caused the loop to immediately exit again after the first iteration, thus never actually looping.
Follow-up to [50959].
Props schlessera.
git-svn-id: https://develop.svn.wordpress.org/trunk@51472 602fd350-edb4-49c9-b593-d223f7449a82
In WordPress 5.8 we added the ability to only load styles for blocks when these blocks are rendered. However, these optimizations left out block-styles that get added using the register_block_style() function/API.
Props aristath.
Fixes#53616.
git-svn-id: https://develop.svn.wordpress.org/trunk@51471 602fd350-edb4-49c9-b593-d223f7449a82
Using the `assertContains()` and `assertNotContains()` methods with string haystacks was deprecated in PHPUnit 8 and removed in PHPUnit 9.
While WordPress test suite currently only supports PHPUnit up to 7.5.x, this allows us to switch to newer assertions ahead of adding full support for PHPUnit 8+.
These methods introduced in PHPUnit 7.5 should be used as an alternative:
* `assertStringContainsString()`
* `assertStringContainsStringIgnoringCase`
* `assertStringNotContainsString()`
* `assertStringNotContainsStringIgnoringCase`
As WordPress currently uses PHPUnit 5.7.x to run tests on PHP 5.6, polyfills for these methods were added to the `WP_UnitTestCase` class for PHPUnit < 7.5.
Follow-up to [51331], [51451], [51461].
Props jrf, dd32, SergeyBiryukov.
See #53363, #46149.
git-svn-id: https://develop.svn.wordpress.org/trunk@51462 602fd350-edb4-49c9-b593-d223f7449a82
This replaces instances of `assertFalse( stripos( ... ) )` with `assertStringNotContainsString()` or `assertStringNotContainsStringIgnoringCase()` to use native PHPUnit functionality.
Going forward, these methods introduced in PHPUnit 7.5 should be used for similar assertions:
* `assertStringContainsString()`
* `assertStringContainsStringIgnoringCase()`
* `assertStringNotContainsString()`
* `assertStringNotContainsStringIgnoringCase()`
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], [51451], [51453], [51454].
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51461 602fd350-edb4-49c9-b593-d223f7449a82
This includes three minor updates to generated CSS files:
- A single `-webkit-` prefix is removed for `min-width`, which was required for Safari <= 10.1 (0.06% total global usage). WordPress only supports the last two versions.
- 2 instances where the `-o-` prefix are added for `tab-size`. This appears to be for Opera Mobile, which has creeped back over the 1% global usage.
Props peterwilsoncc, jorbin.
Fixes#53686.
git-svn-id: https://develop.svn.wordpress.org/trunk@51456 602fd350-edb4-49c9-b593-d223f7449a82
This replaces instances of `assertTrue( ... > 0 )` with `assertGreaterThan()` to use native PHPUnit functionality.
Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448], [51449], [51451], [51453].
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51454 602fd350-edb4-49c9-b593-d223f7449a82
This replaces instances of `assertSame( true, ... )` with `assertTrue()` to use native PHPUnit functionality.
Follow-up to [38832].
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51453 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a "Class not found" PHP fatal error when running these tests separately.
Follow-up to [38832].
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51452 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@51451 602fd350-edb4-49c9-b593-d223f7449a82
`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.
git-svn-id: https://develop.svn.wordpress.org/trunk@51450 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@51449 602fd350-edb4-49c9-b593-d223f7449a82
This replaces instances of `assertTrue( is_string( ... ) )` with `assertIsString()` to use native PHPUnit functionality.
Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438].
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51448 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@51443 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@51442 602fd350-edb4-49c9-b593-d223f7449a82
Wrap call to this.updateLoadMoreView() is wrapped in a check that infinite scroll is disabled to prevent JS errors.
Props wildworks.
Fixes#53672.
git-svn-id: https://develop.svn.wordpress.org/trunk@51440 602fd350-edb4-49c9-b593-d223f7449a82
This replaces instances of `assertTrue( is_numeric( ... ) )` with `assertIsNumeric()` to use native PHPUnit functionality.
Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436].
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51438 602fd350-edb4-49c9-b593-d223f7449a82
This replaces instances of `assertTrue( is_a( ... ) )` with `assertInstanceOf()` to use native PHPUnit functionality.
Follow-up to [51335], [51337], [51367], [51397], [51403], [51404].
See #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@51436 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@51434 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@51432 602fd350-edb4-49c9-b593-d223f7449a82
The `$post` parameter is required and does not have a default value.
Follow-up to [42397].
Props denisco.
See #53399.
git-svn-id: https://develop.svn.wordpress.org/trunk@51425 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@51421 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@51419 602fd350-edb4-49c9-b593-d223f7449a82