Commit Graph

4027 Commits

Author SHA1 Message Date
Sergey Biryukov
a5bef1ea91 Tests: Correct class name for WP_Filesystem_Base::find_folder() tests.
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
2021-07-22 16:44:34 +00:00
Sergey Biryukov
c70fe62ed1 Tests: Replace assertContains() with assertStringContainsString() when used with strings.
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
2021-07-19 14:00:11 +00:00
Sergey Biryukov
bb3bf22547 Tests: Use more appropriate assertions in various tests.
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
2021-07-19 13:29:45 +00:00
Sergey Biryukov
4a533f4879 Tests: Use more appropriate assertions in various tests.
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
2021-07-18 14:10:24 +00:00
Sergey Biryukov
ba94d9b67b Tests: Use more appropriate assertions in rest_sanitize_request_arg() tests.
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
2021-07-18 14:00:35 +00:00
Sergey Biryukov
f28e3d0b88 Tests: Require the WP_REST_Test_Controller class in WP_REST_Controller tests.
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
2021-07-18 13:45:57 +00:00
Sergey Biryukov
54c54f9a1e Tests: Use more appropriate assertions in various tests.
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
2021-07-17 10:36:52 +00:00
Sergey Biryukov
570d86da90 Tests: Correct the test for autosaving a post with Ajax.
`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
2021-07-17 10:23:57 +00:00
Sergey Biryukov
bf3d6dd642 Tests: Use more appropriate assertions in various tests.
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
2021-07-16 19:13:11 +00:00
Sergey Biryukov
bec8574024 Tests: Use more appropriate assertions in various tests.
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
2021-07-16 09:50:47 +00:00
Riad Benguella
a74568e96d Block Editor: Backport fixes targetted for WordPress 5.8 RC4.
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
2021-07-15 18:53:34 +00:00
Sergey Biryukov
56a90eb273 Tests: Use more appropriate assertions in various tests.
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
2021-07-15 14:44:22 +00:00
Sergey Biryukov
cc5e3f7811 Tests: Use more appropriate assertions in various tests.
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
2021-07-15 09:06:20 +00:00
SergeyBiryukov
013b0c11f0 Tests: Reset $current_screen global between tests to avoid cross-test interdependencies.
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
2021-07-13 16:13:01 +00:00
Sergey Biryukov
b396844d38 Tests: Clean up skipping conditions and requirements for various tests.
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.

git-svn-id: https://develop.svn.wordpress.org/trunk@51415 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-13 10:43:42 +00:00
Jonathan Desrosiers
daea174b3f Widgets: Use wp_sidebar_description() to retrieve a sidebar’s description.
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.

git-svn-id: https://develop.svn.wordpress.org/trunk@51408 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-12 19:02:53 +00:00
Sergey Biryukov
bb389cda94 Coding Standards: Fix WPCS issue in [51404].
This fixes an "Expected 1 spaces before closing parenthesis; 0 found" error.

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51405 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-12 10:52:48 +00:00
Sergey Biryukov
c96a42e08a Tests: Use more appropriate assertions in various tests.
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.

git-svn-id: https://develop.svn.wordpress.org/trunk@51404 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-12 10:35:44 +00:00
Sergey Biryukov
5d9a38ef41 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( empty( ... ) )` with `assertEmpty()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51403 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-11 12:41:48 +00:00
Sergey Biryukov
d77f065f24 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( isset( ... ) )` with `assertArrayHasKey()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51397 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-10 11:15:44 +00:00
Jorge Costa
6bd5962c7d Block Editor: Fix for theme.json: color.duotone and spacing.units should allow empty sets.
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.

git-svn-id: https://develop.svn.wordpress.org/trunk@51383 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-08 19:30:18 +00:00
Timothy Jacobs
c283bf2bb6 REST API: Ensure a sidebar's widgets property is a list.
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.


git-svn-id: https://develop.svn.wordpress.org/trunk@51377 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-07 19:34:33 +00:00
Jonathan Desrosiers
953e1c5f83 Tests: Add missed file update in [51370].
See #53497.

git-svn-id: https://develop.svn.wordpress.org/trunk@51371 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-07 15:54:40 +00:00
Jonathan Desrosiers
0834d01365 Themes: Remove mention of “FSE” in Core.
“FSE” themes are block themes.

Fixes #53497.

git-svn-id: https://develop.svn.wordpress.org/trunk@51370 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-07 15:48:13 +00:00
Jonathan Desrosiers
00fc6b5ecd Tests: Expand tests for get_block_editor_settings().
This adds unit tests to ensure `get_block_editor_settings()` properly maps some previously experimental features to their correct locations in the array of contextualized block editor settings returned by the function.

Follow up to [51149], [51213].

Props felipeelia.
Fixes #53458.

git-svn-id: https://develop.svn.wordpress.org/trunk@51369 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-07 14:12:46 +00:00
Sergey Biryukov
73e24c997c Coding Standards: Fix WPCS issues in [51367].
This fixes an "Expected 1 space after comma in argument list; 2 found" error.

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51368 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-07 10:50:43 +00:00
Sergey Biryukov
e77691036d Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertSame( [number], count( ... ) )` with `assertCount()` to use native PHPUnit functionality.

Follow-up to [51335], [51337].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51367 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-07 10:32:56 +00:00
Ian Dunn
8a8f0149b5 Multisite: Log error/warnings/notices from ms-files.php.
Previously errors were not displayed or logged, but the original intention was only to prevent them from being displayed. Hiding them from logs makes problems like #53492 much harder to debug.

This makes the handling of errors in `ms-files` consistent with the REST API, `admin-ajax`, and XML-RPC.

Props iandunn, johnjamesjacoby.
Fixes #53493.


git-svn-id: https://develop.svn.wordpress.org/trunk@51358 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-06 20:20:51 +00:00
Jonathan Desrosiers
0690170556 Posts: Prevent an empty excerpt when groups and nested column blocks are present.
This improves the logic within `excerpt_remove_blocks()` to better handle `innerBlocks`. This prevents an empty excerpt from being returned when `core/columns`, `core/column`, and `core/group` blocks are present.

This issue has been surfaced in the Query Loop block, where excerpts can be set to display. 

Props aristath.
Fixes #53604.

git-svn-id: https://develop.svn.wordpress.org/trunk@51348 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-06 15:31:48 +00:00
Riad Benguella
dd332ea876 Block Editor: Update packages with latest fixes for 5.8 RC2
Includes the following fixes:

 - [Block Library]: Less warnings when blocks try to render themselves.
 - Reset z-index on focused widget form
 - Refactor appender margin.
 - Fix slash inserter for widgets screen.
 - Widget screens: set html block as freeform content handler.
 - Widget Block: widget_id is undefined when a widget is placed.
 - Add <CopyHandler> to WidgetAreasBlockEditorProvider
 - Add width: 100% to components-base-control inside wp-block-legacy-widget
 - [Widgets editor] Replace the "technical" error notice a more user-friendly one
 - Fix legacy widget height overflow 
 - Fix "Select all" behavior in the editor 
 - Increase specificity of the NoPreview CSS rules to avoid conflicts with theme styles
 - Fix move to widget area checkmark
 - Replace legacy widget icon with its new version
 - [Block Library - Query Loop]: Set default block variations not to inherit from global query

See #53397.


git-svn-id: https://develop.svn.wordpress.org/trunk@51344 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-06 14:36:26 +00:00
Sergey Biryukov
2a73ddeab0 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( is_object( ... ) )` with `assertIsObject()` to use native PHPUnit functionality.

Follow-up to [51331], [51335].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51337 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-06 12:31:19 +00:00
Sergey Biryukov
24479f2141 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( is_array( ... ) )` with `assertIsArray()` to use native PHPUnit functionality.

Follow-up to [51331].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51335 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-06 12:25:53 +00:00
Sergey Biryukov
67f31935d0 Tests: Move loading compatibility layers for PHPUnit 6+ and 7.5+ closer together.
Follow-up to [40536], [44701], [50986].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51333 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-06 11:33:27 +00:00
Sergey Biryukov
bca693b190 Build/Test Tools: Replace assertInternalType() usage in unit tests.
The `assertInternalType()` and `assertNotInternalType()` methods are 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:

* `assertIsArray()`
* `assertIsBool()`
* `assertIsFloat()`
* `assertIsInt()`
* `assertIsNumeric()`
* `assertIsObject()`
* `assertIsResource()`
* `assertIsString()`
* `assertIsScalar()`
* `assertIsCallable()`
* `assertIsIterable()`
* `assertIsNotArray()`
* `assertIsNotBool()`
* `assertIsNotFloat()`
* `assertIsNotInt()`
* `assertIsNotNumeric()`
* `assertIsNotObject()`
* `assertIsNotResource()`
* `assertIsNotString()`
* `assertIsNotScalar()`
* `assertIsNotCallable()`
* `assertIsNotIterable()`

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.

Props pbearne, jrf, dd32, SergeyBiryukov.
Fixes #53491. See #46149.

git-svn-id: https://develop.svn.wordpress.org/trunk@51331 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-05 17:21:53 +00:00
John Blackbourn
d059b898fe Docs: Descriptive improvements and corrections for various docblocks.
See #53399


git-svn-id: https://develop.svn.wordpress.org/trunk@51300 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-01 21:11:48 +00:00
John Blackbourn
28ea7b18cf Docs: Corrections and improvements to types used in docblocks for symbols, properties, and filters.
See #53399


git-svn-id: https://develop.svn.wordpress.org/trunk@51298 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-01 21:01:17 +00:00
Sergey Biryukov
6da1212c97 Coding Standards: Add missing visibility keywords to WP_Theme, WP_Theme_JSON, and WP_Theme_JSON_Resolver tests.
Follow-up to [50959], [50960], [50967].

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@51287 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-30 18:21:52 +00:00
Sergey Biryukov
f6760ece8e Docs: Add @ticket references to some WP_Theme_JSON tests.
Follow-up to [50973], [51054].

See #52628, #53461.

git-svn-id: https://develop.svn.wordpress.org/trunk@51281 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-30 15:58:51 +00:00
Sergey Biryukov
8a7495701f REST API: Allow multiple widgets to be deleted in a single batch request.
This resets the `WP_Widget::$updated` flag when deleting a widget, to avoid blocking all future updates in a request.

Props noisysocks, andraganescu.
Fixes #53557.

git-svn-id: https://develop.svn.wordpress.org/trunk@51277 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-30 10:40:21 +00:00
Peter Wilson
212c928038 Query: Check each post-type's capabilities when querying multiple post-types.
When querying multiple post types, check the `read_private_posts` capability for each post type when determining which post statuses to return. This ensures private posts appear in search results and archives for users permitted to read them.

Props leogermani, hellofromTonya, jeffpaul, peterwilsoncc.
Fixes #48556.



git-svn-id: https://develop.svn.wordpress.org/trunk@51276 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-30 04:59:10 +00:00
Jonathan Desrosiers
36012064f6 Build/Test Tools: Revert [51259-51256,51265].
[51259] introduced a PHP notice that was not actually fixed by [51265]. Reverting these changes in order to investigate further.

See #53397.

git-svn-id: https://develop.svn.wordpress.org/trunk@51268 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-30 02:13:30 +00:00
Riad Benguella
51cbe7eeb7 Build: Split packages and blocks to their webpack configs.
This also adds support for the viewScript for blocks fixing 
the PDF preview for file blocks.

Props desrosj, gziolo.
See #53397.


git-svn-id: https://develop.svn.wordpress.org/trunk@51259 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-29 15:08:16 +00:00
Robert Anderson
fba7649418 Widgets REST API: Fix non-multi widgets not appearing in wp_inactive_widgets
Registered widgets that do not extend WP_Widget should appear in the
wp_inactive_widgets sidebar by default. Having the widgets REST API call
retrieve_widgets() before serving any request ensures that this will happen.

This is a similar fix to [51235].

Fixes #53534.
Props zieladam, timothyblynjacobs.


git-svn-id: https://develop.svn.wordpress.org/trunk@51248 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-28 04:33:36 +00:00
Sergey Biryukov
00be7573c6 General: Ensure svn:eol-style is consistently set for all recently added files.
Follow-up to [49135], [49226], [49320], [49478], [49574], [51198].

Fixes #53528.

git-svn-id: https://develop.svn.wordpress.org/trunk@51246 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-27 12:44:45 +00:00
Timothy Jacobs
1de9c692f3 REST API: Retrieve latest widgets before loading sidebars.
This fixes issues where sidebars would be unexpectedly missing from the new widgets screen. Running retrieve_widgets syncs sidebars that were registered after the last theme switch.

Props walbo, hellofromTonya, noisysocks.
Fixes #53489.


git-svn-id: https://develop.svn.wordpress.org/trunk@51235 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-25 13:17:20 +00:00
Sergey Biryukov
67fc415084 Tests: Correct PHPUnit version requirement in tests using ::createPartialMock().
The method was introduced in PHPUnit 5.5, not 6.0.

Follow-up to [48945], [48947] [51226].

See #52625.

git-svn-id: https://develop.svn.wordpress.org/trunk@51234 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-25 10:38:23 +00:00
Jonathan Desrosiers
fc0c7a01f2 Widgets: Fix an “Invalid value” warning when adding a new widget in the Customizer.
This fixes a regression introduced in [50996] where sites that have been opted-out of the block-based widget editor experienced an “Invalid value.” error when adding a new widget to a sidebar in the Customizer.

This was caused by the early return value was changed to `null` from `$value` when set to an empty `array`, resulting in the widget being evaluated as invalid elsewhere.

Props jamesros161, caseymilne, naoki0h, ixkaito, zieladam, noisysocks, hellofromTonya.
Fixes #53479.

git-svn-id: https://develop.svn.wordpress.org/trunk@51232 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-25 00:07:15 +00:00
Jonathan Desrosiers
3dc566ba89 Widgets: Add missing label and description to Customizer controls.
This fixes a bug where the “Move To” dialogue was empty when a theme has multiple widget areas.

Props kevin940726, noisysocks, hellofromTonya.
Fixes #53487.

git-svn-id: https://develop.svn.wordpress.org/trunk@51228 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-24 19:19:57 +00:00
Sergey Biryukov
f5ae410c33 Tests: Require PHPUnit >= 6 in tests using ::createPartialMock().
This avoids a "Call to undefined method" fatal error when running the tests with PHPUnit 5.4.x, which WordPress still supports as the minimum version.

Follow-up to [48945], [48947].

See #52625.

git-svn-id: https://develop.svn.wordpress.org/trunk@51226 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-24 10:04:41 +00:00
Sergey Biryukov
735ecc0ba9 Tests: Use assertSame() in _wp_to_kebab_case() 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 [51079], [51198].

See #52482, #52625, #53397.

git-svn-id: https://develop.svn.wordpress.org/trunk@51225 602fd350-edb4-49c9-b593-d223f7449a82
2021-06-24 06:51:54 +00:00