wordpress-develop/tests/phpunit/tests/theme-previews.php
Daniel Bachhuber a1852bd49b Editor: Add function prefix to avoid conflicts.
Transforms `initialize_theme_preview_hooks` to `wp_initialize_theme_preview_hooks` to avoid conflicts with third-party code.

Follow up to [56529].

Props okat.
See #59000.


git-svn-id: https://develop.svn.wordpress.org/trunk@56757 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-02 22:40:36 +00:00

28 lines
844 B
PHP

<?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 `wp_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 );
}
}