Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/phpunit/tests/media/wpCrossOriginIsolation.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class Tests_Media_wpCrossOriginIsolation extends WP_UnitTestCase {
*/
private ?string $original_pagenow;

/**
* Original stylesheet before the test switches themes.
*/
private string $original_stylesheet;

public function set_up() {
parent::set_up();
$this->original_user_agent = $_SERVER['HTTP_USER_AGENT'] ?? null;
Expand All @@ -48,6 +53,7 @@ public function set_up() {
$this->original_get_action = $_GET['action'] ?? null;
$this->original_get_p = $_GET['p'] ?? null;
$this->original_pagenow = $GLOBALS['pagenow'] ?? null;
$this->original_stylesheet = get_stylesheet();
}

public function tear_down() {
Expand Down Expand Up @@ -89,6 +95,10 @@ public function tear_down() {

$GLOBALS['current_screen'] = null;

if ( get_stylesheet() !== $this->original_stylesheet ) {
switch_theme( $this->original_stylesheet );
}

remove_all_filters( 'wp_client_side_media_processing_enabled' );
parent::tear_down();
}
Expand Down
Loading