Skip to content
Closed
Prev Previous commit
Next Next commit
ensure all code runs before the assertions
  • Loading branch information
Mamaduka committed Feb 3, 2023
commit 9870b442a099939fc71b29804d35ca2ecf2b95bf
5 changes: 3 additions & 2 deletions tests/phpunit/tests/theme/wpThemeJsonResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -839,18 +839,19 @@ public function test_get_merged_data_returns_origin( $origin, $core_palette, $co
$theme_json = WP_Theme_JSON_Resolver::get_merged_data( $origin );
$settings = $theme_json->get_settings();
$styles = $theme_json->get_styles_block_nodes();
$this->assertSame( $core_palette, isset( $settings['color']['palette']['default'] ), $core_palette_text );
$styles = array_filter(
$styles,
static function( $element ) {
return isset( $element['name'] ) && 'my/block-with-styles' === $element['name'];
}
);
unregister_block_type( 'my/block-with-styles' );

$this->assertSame( $core_palette, isset( $settings['color']['palette']['default'] ), $core_palette_text );
$this->assertSame( $block_styles, count( $styles ) === 1, $block_styles_text );
$this->assertSame( $theme_palette, isset( $settings['color']['palette']['theme'] ), $theme_palette_text );
$this->assertSame( $user_palette, isset( $settings['color']['palette']['custom'] ), $user_palette_text );

unregister_block_type( 'my/block-with-styles' );
}

/**
Expand Down