wordpress-develop/tests/phpunit/tests/admin
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
..
includesComment.php Code is Poetry. 2017-11-30 23:09:33 +00:00
includesCommunityEvents.php Docs: Update @since versions in Community Events class added in [42726]. 2018-06-16 10:38:27 +00:00
includesFile.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
includesListTable.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
includesMisc.php Code is Poetry. 2017-11-30 23:09:33 +00:00
includesPlugin.php Code is Poetry. 2017-11-30 23:09:33 +00:00
includesPost.php Posts, Post Types: Add type parameter to post_exists(). 2019-03-21 12:43:48 +00:00
includesSchema.php Upgrade/Install: Properly exclude the admin/includesSchema.php tests file for the WordPress.DB.PreparedSQL.NotPrepared sniff. 2018-09-14 07:54:53 +00:00
includesScreen.php Administration: Improve the accuracy of is_block_editor(). 2019-04-17 01:55:21 +00:00
includesTemplate.php Code is Poetry. 2017-11-30 23:09:33 +00:00
includesTheme.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
includesUpdateCore.php Build/Test Tools: Utilise assertFileExists() and assertFileNotExists() in more places. 2016-11-08 23:49:11 +00:00
wpPrivacyRequestsTable.php Privacy: Allow column sorting in the privacy request admin tables. 2019-01-16 17:51:56 +00:00