mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Editor: Prevent possibility of a fatal error when previewing block themes.
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
This commit is contained in:
27
tests/phpunit/tests/theme-previews.php
Normal file
27
tests/phpunit/tests/theme-previews.php
Normal file
@@ -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 );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user