Wordpress/tests/phpunit/tests
Jonathan Desrosiers d575d70fe9 Administration: Improve the accuracy of is_block_editor().
Currently, there are a number of scenarios where `is_block_editor()` (and `WP_Screen::is_block_editor`) would incorrectly indicate block editor support at different points of the loading process. Most notably, checking `is_block_editor` when hooking into the `current_screen` action will always result in `false`, even when the block editor is being loaded. This is because `is_block_editor` is not set to `true` until `edit-form-blocks.php` is included.

This change adds logic to `WP_Screen` to ensure the accuracy of `is_block_editor` on block editor pages earlier in the load process.

While edit screens will now be accurate 100% of the time from `current_screen` on, there are still a few edge cases where `is_block_editor` could contain an incorrect value when creating a new post.

Because a `WP_Post` object is a required parameter for the `replace_editor` filter and `use_block_editor_for_post()` function, `WP_Screen` will fall back to the value returned by `use_block_editor_for_post_type()` for the post being created. To eliminate these edge cases, the `use_block_editor_for_post_type` filter can be used to return the appropriate boolean value to indicate support.

Props Chouby, desrosj, aduth, johnbillion.
Fixes #46195.

git-svn-id: https://develop.svn.wordpress.org/trunk@45224 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-17 01:55:21 +00:00
..
actions Code is Poetry. 2017-11-30 23:09:33 +00:00
admin Administration: Improve the accuracy of is_block_editor(). 2019-04-17 01:55:21 +00:00
ajax Tests: Fix failing tests for privacy export/erase requests when running the ajax group for multisite. 2019-03-20 17:40:17 +00:00
attachment Code is Poetry. 2017-11-30 23:09:33 +00:00
blocks Blocks: Allow for nested the_content calls within do_blocks(). 2019-04-08 06:53:14 +00:00
bookmark General: Fix existing coding standard violations in bookmark tests, as outlined in [44546]. 2019-01-10 21:16:49 +00:00
canonical Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
category Taxonomy: Make sure wp_list_categories() correctly outputs term name of 0. 2018-09-02 22:08:05 +00:00
comment Comments: Show the "awaiting moderation" message when comment cookies are disabled. 2019-01-21 01:33:50 +00:00
customize Customizer: Fix a coding standards issue introduced in [44580]. 2019-01-14 07:22:03 +00:00
date Tests: Fix the tests for the c and r formats in date_i18n(). 2019-01-29 01:19:30 +00:00
db Code is Poetry. 2017-11-30 23:09:33 +00:00
dependencies Build: Fix formatting issues introduced in [44740]. 2019-02-14 00:41:15 +00:00
editor Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
error-protection Bootstrap/Load: Allow more than one recovery link to be valid at a time. 2019-04-16 05:08:16 +00:00
external-http Embeds: Remove the external oEmbed tests for YouTube. 2017-10-03 16:51:25 +00:00
feed Build: correct some linting errors. 2019-03-20 22:05:58 +00:00
filesystem Tests: Add missing parent::setUp() calls to all test classes. 2019-01-14 04:54:01 +00:00
formatting Emoji: Update Twemoji to version 12.0.0. 2019-04-08 05:21:49 +00:00
functions Tests: Add tests for the __return*() functions. 2019-01-21 00:32:33 +00:00
general Themes: Remove itemprop="url" from get_custom_logo() output. 2019-03-27 12:15:15 +00:00
hooks Code is Poetry. 2017-11-30 23:09:33 +00:00
http HTTP: Add support for the host-only flag to Wp_Http_Cookie. 2019-04-08 05:31:35 +00:00
image Media: Improve and fix rotate/flip image tests 2019-03-29 02:48:08 +00:00
import Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
includes Bootstrap/Load: After [45016], make sure wp_die() does not cause _doing_it_wrong() notices if called before $wp_query global is set. 2019-04-15 23:48:11 +00:00
l10n I18N: Fix JavaScript translations for subdirectory installations. 2018-12-18 23:09:51 +00:00
link Link Template: In get_adjacent_post(), move the sanitisation of $excluded_terms earlier. 2019-01-15 01:53:02 +00:00
load Bootstrap: Enhance core's memory limit handling. 2016-07-08 14:36:37 +00:00
media Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
menu Menus: Add rel="noopener" to target="_blank" links by default in menus. 2019-04-08 23:05:22 +00:00
meta Options, Meta APIs: Remove an accidental short array syntax in the tests. 2019-03-28 22:02:10 +00:00
multisite Multisite: add new sites_pre_query and networks_pre_query filters to short circuit WP_Site_Query and WP_Network_Query queries. 2019-03-22 17:25:38 +00:00
oembed Accessibility: Ensure embed iframes have a title attribute. 2019-03-20 17:21:56 +00:00
option Options: Avoid unnecessary DB calls when updating network options. 2019-01-21 04:26:33 +00:00
pomo Tests: Add missing parent::setUp() calls to all test classes. 2019-01-14 04:54:01 +00:00
post PHPCS: Fix WPCS violation in [45088]. 2019-04-01 16:48:32 +00:00
privacy Privacy: Only mark a personal data export as complete when the user downloads it. 2019-04-09 00:03:07 +00:00
query PHPCS: Remove extra spaces added in [44966]. 2019-03-21 20:19:16 +00:00
rest-api REST API: Avoid undefined-property notice when setting parent term to 0. 2019-03-21 18:58:50 +00:00
rewrite Tests: Add missing parent::setUp() calls to all test classes. 2019-01-14 04:54:01 +00:00
taxonomy Tests: Add missing parent::setUp() calls to all test classes. 2019-01-14 04:54:01 +00:00
term REST API: Move object type-specific metadata integrations from the wrapper functions to the low-level Meta API functions. 2018-12-12 03:02:00 +00:00
theme Themes: Introduce responsive embeds support. 2018-12-14 01:49:46 +00:00
url Privacy: Introduce Privacy Policy page helpers: 2019-03-21 19:47:29 +00:00
user Bootstrap/Load: Introduce a recovery mode for fixing fatal errors. 2019-03-21 21:52:07 +00:00
widgets Widgets: Add rel="noopener noreferrer" to links with target="_blank" in the Image widget. 2019-04-08 23:22:14 +00:00
xmlrpc Replace usages of basename() with wp_basename() in order to support multibyte filenames 2019-03-01 20:57:26 +00:00
actions.php Code is Poetry. 2017-11-30 23:09:33 +00:00
adminbar.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
auth.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
avatar.php Coding Standards: Fix and whitelist variable names. 2019-01-12 06:05:55 +00:00
basic.php Build/Test tools: Remove unnecessary PHP functionality tests from the test suite. 2017-12-09 23:08:24 +00:00
cache.php Code is Poetry. 2017-11-30 23:09:33 +00:00
canonical.php Canonical: Ensure redirect query keys are URL encoded. 2019-04-08 01:09:01 +00:00
category.php Code is Poetry. 2017-11-30 23:09:33 +00:00
comment-submission.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
comment.php Privacy: Don't replace comment author URL and email with anything. 2018-07-17 08:59:30 +00:00
compat.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
cron.php Cron: Ensure identical single events aren't scheduled less than 10min apart. 2019-03-16 06:41:23 +00:00
db.php WPDB: Check that $wpdb->last_result is countable before counting with it. 2018-12-17 18:38:13 +00:00
dbdelta.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
dependencies.php Code is Poetry. 2017-11-30 23:09:33 +00:00
file.php Code is Poetry. 2017-11-30 23:09:33 +00:00
filters.php Code is Poetry. 2017-11-30 23:09:33 +00:00
functions.php Media: grid view attachment filter drop down - only show available mime types. 2019-03-20 20:06:22 +00:00
kses.php KSES: Allow the download attribute on <a> tags. 2018-12-14 03:27:55 +00:00
l10n.php Build/Test Tools: Fix coding standards issues after [44515] and [44514]. 2019-01-09 12:36:43 +00:00
link.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
locale.php Tests: Add missing parent::setUp() calls to all test classes. 2019-01-14 04:54:01 +00:00
mail.php Code is Poetry. 2017-11-30 23:09:33 +00:00
media.php Replace usages of basename() with wp_basename() in order to support multibyte filenames 2019-03-01 20:57:26 +00:00
meta.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
multisite.php Code is Poetry. 2017-11-30 23:09:33 +00:00
pluggable.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
post.php Permalinks: Add a pre_wp_unique_post_slug filter. 2019-01-08 03:46:58 +00:00
query.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
rest-api.php REST API: Encourage proper usage of register_rest_route(). 2019-01-11 18:18:41 +00:00
rewrite.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
shortcode.php Coding Standards: Extract extract() from the codebase. 2019-01-12 03:19:23 +00:00
taxonomy.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
template.php PHPCS: Remove extra spaces added in [44966]. 2019-03-21 20:19:16 +00:00
term.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
theme.php Privacy: Introduce Privacy Policy page helpers: 2019-03-21 19:47:29 +00:00
upload.php Code is Poetry. 2017-11-30 23:09:33 +00:00
url.php Code is Poetry. 2017-11-30 23:09:33 +00:00
user.php Build Tools: Upgrade WPCS to 2.0.0. 2019-01-18 02:14:24 +00:00
walker.php Code is Poetry. 2017-11-30 23:09:33 +00:00
widgets.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
wp.php Tests: Add missing parent::setUp() calls to all test classes. 2019-01-14 04:54:01 +00:00