Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,17 @@ public function set_up() {
$this->revision_3_id = $this->revision_3->ID;
}

/**
* Sets the current user to the admin, granting super admin on multisite
* so global styles JSON is not stripped by KSES on save.
*/
private function set_admin_user_with_unfiltered_html() {
if ( is_multisite() ) {
grant_super_admin( self::$admin_id );
}
wp_set_current_user( self::$admin_id );
}

/**
* @ticket 58524
* @ticket 59810
Expand Down Expand Up @@ -991,7 +1002,7 @@ public function test_get_global_styles_revisions_pagination() {
* @covers WP_REST_Global_Styles_Revisions_Controller::prepare_item_for_response
*/
public function test_get_item_preserves_block_style_variations() {
wp_set_current_user( self::$admin_id );
$this->set_admin_user_with_unfiltered_html();
switch_theme( 'block-theme-child-with-block-style-variations' );

// Create a global styles post for the theme.
Expand Down Expand Up @@ -1077,7 +1088,7 @@ public function test_get_item_preserves_block_style_variations() {
* @covers WP_REST_Global_Styles_Revisions_Controller::prepare_item_for_response
*/
public function test_multiple_block_variations_are_preserved() {
wp_set_current_user( self::$admin_id );
$this->set_admin_user_with_unfiltered_html();
switch_theme( 'block-theme-child-with-block-style-variations' );

// Create a global styles post for the theme.
Expand Down Expand Up @@ -1181,7 +1192,7 @@ public function test_multiple_block_variations_are_preserved() {
* @covers WP_REST_Global_Styles_Revisions_Controller::prepare_item_for_response
*/
public function test_theme_variations_are_registered_for_revisions() {
wp_set_current_user( self::$admin_id );
$this->set_admin_user_with_unfiltered_html();
switch_theme( 'block-theme-child-with-block-style-variations' );

// Verify the theme has a block style variation defined.
Expand Down Expand Up @@ -1264,7 +1275,7 @@ public function test_theme_variations_are_registered_for_revisions() {
* @covers WP_REST_Global_Styles_Revisions_Controller::prepare_item_for_response
*/
public function test_get_items_preserves_block_style_variations() {
wp_set_current_user( self::$admin_id );
$this->set_admin_user_with_unfiltered_html();
switch_theme( 'block-theme-child-with-block-style-variations' );

// Create a global styles post for the theme.
Expand Down
Loading