forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editor: Prevent possibility of a fatal error when previewing block th…
…emes. Ensures that preview callbacks attached to the `stylesheet` and `template` filters do not run before `pluggable.php` has been included. These callbacks need functionality from `pluggable.php`. Props: scruffian, johnbillion, SergeyBiryukov, okat, okat. Fixes: #59000. git-svn-id: https://develop.svn.wordpress.org/trunk@56529 602fd350-edb4-49c9-b593-d223f7449a82
- Loading branch information
Showing
3 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/** | ||
* test wp-includes/theme-previews.php | ||
* | ||
* @group themes | ||
*/ | ||
class Tests_Theme_Previews extends WP_UnitTestCase { | ||
public function set_up() { | ||
parent::set_up(); | ||
} | ||
|
||
public function tear_down() { | ||
unset( $_GET['wp_theme_preview'] ); | ||
parent::tear_down(); | ||
} | ||
|
||
public function test_initialize_theme_preview_hooks() { | ||
$_GET['wp_theme_preview'] = 'twentytwentythree'; | ||
do_action( 'plugins_loaded' ); // Ensure `plugins_loaded` triggers `initialize_theme_preview_hooks`. | ||
|
||
$this->assertEquals( has_filter( 'stylesheet', 'wp_get_theme_preview_path' ), 10 ); | ||
$this->assertEquals( has_filter( 'template', 'wp_get_theme_preview_path' ), 10 ); | ||
$this->assertEquals( has_action( 'init', 'wp_attach_theme_preview_middleware' ), 10 ); | ||
$this->assertEquals( has_action( 'admin_head', 'wp_block_theme_activate_nonce' ), 10 ); | ||
} | ||
} |