In [51838], the test wrapper methods were not being called due to the names not being recognized as supported PHPUnit "hook" names for fixtures.
This commit:
- Fixes the problem by adding extra camelCase wrappers to the `WP_UnitTestCase` to call the methods in the right order.
- Adds wrappers for the `assertPreConditions()` and `assertPostConditions()` fixture methods to make the backport feature complete for the fixture wrappers.
Test wrapper methods call fix:
By adding method overloads for the PHPUnit native camelCase fixture methods and letting those call the (camelCase) parent method first and only calling the snake_case fixture methods after, the snake_case methods can be supported and the typical run order safeguarded.
As not all test classes will have declared snake_case fixture methods, the snake_case fixture methods are also declared in the `WP_UnitTestCase`. Why? This prevents having to wrap these method calls in `method_exists()` conditions checking for the existence of the snake_case methods in an unknown Test child class. And with the normal inheritance rules in combination with calling the method using `static`, the right method will be called anyway without fatal "calling undeclared method" errors.
Note: While it will be rare, there ''may'' be cases where a test class does not adhere to the normal execution order for fixtures, i.e. for the setup methods, parent first, own code second; and for the teardown methods, own code first, parent second. For example a test class which has "some code - `parent::setUp()` call - some more code" in their `setUp()` method. In those (rare) cases, the execution order of the code will now be changed, which may have side-effects. This rare case will be identified in the dev note.
Follow-up to [51838].
Props bjorsch, swisspidy, jrf, hellofromTonya.
See #53911.
Built from https://develop.svn.wordpress.org/branches/5.8@51861
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This backports the PHPUnit Polyfills package and related test infrastructure changes to make it easier for developers to continue testing on multiple versions WordPress while adding tests for newer versions of PHP, which require more modern PHPUnit practices.
One of the changes included is the addition of wrappers for the new snake_case fixture methods in PHPUnit. This allows the native camelCase standard in PHPUnit to be used, but allows for developers to transition to the new naming conventions.
Props hellofromTonya, jrf, SergeyBiryukov, johnbillion, netweb, schlessera, jeherve, lucatume, desrosj.
Merges [51559,51560,51810-51813,51828] to the 5.8 branch.
See #53911.
Built from https://develop.svn.wordpress.org/branches/5.8@51838
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The following packages were updated:
- @wordpress/a11y to `3.1.2`
- @wordpress/annotations to `2.1.6`
- @wordpress/api-fetch to `5.1.2`
- @wordpress/autop to `3.1.2`
- @wordpress/babel-preset-default to `6.2.1`
- @wordpress/blob to `3.1.2`
- @wordpress/block-directory to `2.1.21`
- @wordpress/block-editor to `6.1.14`
- @wordpress/block-library to `3.2.19`
- @wordpress/block-serialization-default-parser to `4.1.2`
- @wordpress/blocks to `9.1.8`
- @wordpress/components to `14.1.11`
- @wordpress/compose to `4.1.6`
- @wordpress/core-data to `3.1.12`
- @wordpress/customize-widgets to `1.0.20`
- @wordpress/data-controls to `2.1.6`
- @wordpress/data to `5.1.6`
- @wordpress/date to `4.1.2`
- @wordpress/deprecated to `3.1.2`
- @wordpress/dom-ready to `3.1.2`
- @wordpress/dom to `3.1.5`
- @wordpress/e2e-test-utils to `5.3.1`
- @wordpress/edit-post to `4.1.21`
- @wordpress/edit-widgets to `2.1.21`
- @wordpress/editor to `10.1.17`
- @wordpress/element to `3.1.2`
- @wordpress/escape-html to `2.1.2`
- @wordpress/format-library to `2.1.14`
- @wordpress/html-entities to `3.1.2`
- @wordpress/i18n to `4.1.2`
- @wordpress/icons to `4.0.3`
- @wordpress/interface to `3.1.12`
- @wordpress/keyboard-shortcuts to `2.1.7`
- @wordpress/keycodes to `3.1.2`
- @wordpress/list-reusable-blocks to `2.1.11`
- @wordpress/media-utils to `2.1.2`
- @wordpress/notices to `3.1.6`
- @wordpress/nux to `4.1.11`
- @wordpress/plugins to `3.1.6`
- @wordpress/primitives to `2.1.2`
- @wordpress/priority-queue to `2.1.2`
- @wordpress/react-i18n to `2.1.2`
- @wordpress/redux-routine to `4.1.2`
- @wordpress/reusable-blocks to `2.1.17`
- @wordpress/rich-text to `4.1.6`
- @wordpress/scripts to `16.1.5`
- @wordpress/server-side-render to `2.1.12`
- @wordpress/shortcode to `3.1.2`
- @wordpress/url to `3.1.2`
- @wordpress/viewport to `3.1.6`
- @wordpress/warning to `2.1.2`
- @wordpress/widgets to `1.1.19`
- @wordpress/wordcount to `3.1.2`
Props oandregal, juanmaguitar, gziolo, jblz, talldanwp, ribaricplusplus, peterwisoncc, youknowriad, paaljoachim, kreppar, ellatrix, aristath, walbo, ajlende, kevin940726, mamaduka, ntsekouras, toro_unit, mkaz, joen, noisysocks, zieladam, andraganescu, antonvlasenko, terraling, dariak, vladytimy, circlecube, desrosj.
Merges [51719] to the 5.8 branch.
Fixes#54052, #52818.
Built from https://develop.svn.wordpress.org/branches/5.8@51721
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51327 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Appends the wp-embed-responsive class to the body if the widgets block editor is enabled. This fixes a bug preventing embeds (e.g. YouTube embeds) appearing in the widgets block editor.
Props walbo, kevin940726, noisysocks.
Merges [51716] to the 5.8 branch.
Fixes#53609.
Built from https://develop.svn.wordpress.org/branches/5.8@51720
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [51422], a few specific edge cases were detailed so that developers using the hook were aware of known pitfalls.
These edge cases have been fixed in 5.8.1 through [51653] and [51704], so the documentation is no longer necessary.
Props azaozz, audrasjb.
Merges [51717] to the 5.8 branch.
Fixes#53955.
Built from https://develop.svn.wordpress.org/branches/5.8@51718
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Move the cleaning of the `wp-includes/css/dist` folder from `clean:css` to `clean:webpack-assets` to avoid an order of operations issue in which the files were built shortly before been deleted later in the build process.
Follow up to [51689].
Props netweb, ramonopoly, peterwilsoncc.
Merges [51713] to the 5.8 branch.
Fixes#53719.
Built from https://develop.svn.wordpress.org/branches/5.8@51714
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `get_block_categories()` function expects either a `WP_Post` or a `WP_Block_Editor_Context` instance as the context argument, not a string.
Follow-up to [50996], [50997].
Props Enchiridion, pbearne, audrasjb, SergeyBiryukov.
Merges [51700] to the 5.8 branch.
Fixes#53757.
Built from https://develop.svn.wordpress.org/branches/5.8@51711
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates the Custom HTML and Media widgets to display the correct fields when adding or editing a widget when using accessibility mode through the Classic Widgets experience.
Follow up to [49973].
Props mark-k, sabernhardt, alexstine, circlecube, audrasjb.
Merges [51701] to the 5.8 branch.
Fixes#53641.
Built from https://develop.svn.wordpress.org/branches/5.8@51710
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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, gziolo.
Merges [51471] to the 5.8 branch.
Fixes#53616.
Built from https://develop.svn.wordpress.org/branches/5.8@51696
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids a fatal error on PHP 8 caused by passing a zero value to `fread()` as the `$length` argument, which must be greater than zero.
This commit also amends the previous solution for similar issues elsewhere in the file to ensure consistent type for string values, instead of changing the type from `string` to `bool` when trying to read from an empty file.
Follow-up to [50355].
Props DavidAnderson, jrf, SergeyBiryukov.
Merges [51686] to the 5.8 branch.
Fixes#54036.
Built from https://develop.svn.wordpress.org/branches/5.8@51694
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `serializeAttributes()` function in JavaScript uses `JSON.stringify`, which does not encode slashes and unicode characters by default. This resulted in the PHP serialization through `json_encode()` producing different results.
This also switches from `json_encode()` to `wp_json_encode()` to prevent failures when any non UTF-8 characters are included.
Props kevinfodness, SergeyBiryukov, timothyblynjacobs.
Merges [51674] to the 5.8 branch.
Fixes#53936.
Built from https://develop.svn.wordpress.org/branches/5.8@51681
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is the correct formatting detailed in the Docker `compose` documentation examples and helps to avoid ambiguities in the yaml parser when values that may cause warnings.
Props pbrearne, ocean90, johnbillion, desrosj.
Merges [51673] to the 5.8 branch.
Fixes#53820.
Built from https://develop.svn.wordpress.org/branches/5.8@51680
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Increase the number of media items displayed per page from 40 to 80 to improve the experience for users navigating the library on sites with a large quantity of media in the library.
Props AlGala, antpb, hellofromTonya, joedolson, SergeyBiryukov, wb1234, peterwilsoncc.
Merges [51632] to the 5.8 branch.
Fixes#53827.
Built from https://develop.svn.wordpress.org/branches/5.8@51643
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Reduces the right margin of the media library modal on small and medium width screens to remove excess white-space. On very narrow screens this was preventing the media icons from displaying.
Props andraganescu, desrosj, joedolson, moch11, mukesh27, sabernhardt, SergeyBiryukov, zieladam, peterwilsoncc.
Merges [51631] to the 5.8 branch.
Fixes#53679.
Built from https://develop.svn.wordpress.org/branches/5.8@51642
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Hide the browser's native radio button on the custom background position selector in the Customizer and the legacy background screen. This fixes an issue causing both to display.
Props mukesh27, ravipatel, sabernhardt, walbo, peterwilsoncc.
Merges [51637] to the 5.8 branch.
Fixes#53803.
Built from https://develop.svn.wordpress.org/branches/5.8@51640
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, the original "404" template key was lost when "Default template" is merged into the available templates array, as the `array_merge()` function renumbers numeric keys. Later, when we merge templates on the client side, this caused duplicate "404" templates to appear in the dropdown.
By replacing the `array_merge()` call with `array_replace()`, we make sure to keep the original numeric keys.
Props Mamaduka, Toro_Unit, youknowriad, SergeyBiryukov.
Merges [51595] to the 5.8 branch.
Fixes#53898.
Built from https://develop.svn.wordpress.org/branches/5.8@51620
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51226 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prevent the bulk-select option from displaying when adding a new menu. This also prevents the option from displaying when an administrator first visits the menu page and no menus are set.
Props dlh, sabernhardt, peterwilsoncc.
Merges [51539] to the 5.8 branch.
Fixes#53654.
Built from https://develop.svn.wordpress.org/branches/5.8@51596
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add a check to `wp_add_iframed_editor_assets_html()` confirming the edit post screen is using the block-editor before including block-editor specific JavaScript. For the classic and other editors the function returns early without any output.
Props swissspidy, desrosj, peterwilsoncc.
Merges [51540] to the 5.8 branch.
Fixes#53696.
Built from https://develop.svn.wordpress.org/branches/5.8@51593
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids a "Table `wp_options` doesn't exist" database error when trying to create a nonce for password reset button.
When installing and using database-saved salts, `wp_create_nonce()` causes database errors as `wp_salt()` attempts to insert into the not-yet-created options table. Since authentication is not available during installation, we can safely skip creating a nonce.
Follow-up to [39684], [50129].
Props schlessera, swissspidy, sanketchodavadiya, hellofromTonya, SergeyBiryukov.
Merges [51525] to the 5.8 branch.
Fixes#53830.
Built from https://develop.svn.wordpress.org/branches/5.8@51546
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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, SergeyBiryukov.
Merges [51473] to the 5.8 branch.
Fixes#53716.
Built from https://develop.svn.wordpress.org/branches/5.8@51506
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Merges [51486] to the 5.8 branch.
Fixes#53777.
Built from https://develop.svn.wordpress.org/branches/5.8@51489
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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, SergeyBiryukov.
Merges [51483] to the 5.8 branch.
Fixes#53769.
Built from https://develop.svn.wordpress.org/branches/5.8@51488
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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, SergeyBiryukov.
Merges [51482] to the 5.8 branch.
Fixes#53752.
Built from https://develop.svn.wordpress.org/branches/5.8@51487
git-svn-id: http://core.svn.wordpress.org/branches/5.8@51098 1a063a9b-81f0-0310-95a4-ce76da25c4cd