Skip to content

Commit

Permalink
Fix suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Nov 25, 2022
1 parent 3b0e7bf commit 75c1202
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions phpunit/class-wp-theme-json-resolver-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public function test_get_user_data_from_wp_global_styles_does_not_use_uncached_q
$this->assertEmpty( $user_cpt, 'User CPT is expected to be empty.' );
}

public function register_block_data( $block_name ) {
private function register_block_data( $block_name ) {
register_block_type(
$block_name,
array(
Expand Down Expand Up @@ -451,7 +451,7 @@ static function( $element ) {
return isset( $element['name'] ) && 'my/block-with-styles' === $element['name'];
}
);
$this->assertTrue( count( $block_styles ) === 1, 'block styles must be defined' );
$this->assertTrue( count( $block_styles ) === 1, 'block styles must be present' );
$this->assertFalse( isset( $settings['color']['palette']['theme'] ), 'theme palette is not present' );
$this->assertFalse( isset( $settings['color']['palette']['custom'] ), 'user palette is not present' );

Expand All @@ -463,7 +463,7 @@ static function( $element ) {
*/
public function test_get_merged_data_returns_origin_theme() {
// Make sure there is data from the blocks origin.
$this::register_block_data( 'my/block-with-styles' );
$this->register_block_data( 'my/block-with-styles' );

// Make sure there is data from the theme origin.
switch_theme( 'block-theme' );
Expand All @@ -474,15 +474,15 @@ public function test_get_merged_data_returns_origin_theme() {
$theme_json = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data( 'theme' );
$settings = $theme_json->get_settings();
$styles = $theme_json->get_styles_block_nodes();
$this->assertTrue( isset( $settings['color']['palette']['default'] ), 'core palette must be defined' );
$this->assertTrue( isset( $settings['color']['palette']['default'] ), 'core palette must be present' );
$block_styles = array_filter(
$styles,
static function( $element ) {
return isset( $element['name'] ) && 'my/block-with-styles' === $element['name'];
}
);
$this->assertTrue( count( $block_styles ) === 1, 'block styles are present' );
$this->assertTrue( isset( $settings['color']['palette']['theme'] ), 'theme palette must be defined' );
$this->assertTrue( count( $block_styles ) === 1, 'block styles must be present' );
$this->assertTrue( isset( $settings['color']['palette']['theme'] ), 'theme palette must be present' );
$this->assertFalse( isset( $settings['color']['palette']['custom'] ), 'user palette is not present' );

unregister_block_type( 'my/block-with-styles' );
Expand All @@ -504,16 +504,16 @@ public function test_get_merged_data_returns_origin_custom() {
$theme_json = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data();
$settings = $theme_json->get_settings();
$styles = $theme_json->get_styles_block_nodes();
$this->assertTrue( isset( $settings['color']['palette']['default'] ), 'core palette isn\'t defined' );
$this->assertTrue( isset( $settings['color']['palette']['default'] ), 'core palette must be present' );
$block_styles = array_filter(
$styles,
static function( $element ) {
return isset( $element['name'] ) && 'my/block-with-styles' === $element['name'];
}
);
$this->assertTrue( count( $block_styles ) === 1, 'block styles are present' );
$this->assertTrue( isset( $settings['color']['palette']['theme'] ), 'theme palette is present' );
$this->assertTrue( isset( $settings['color']['palette']['custom'] ), 'user palette isn\'t defined' );
$this->assertTrue( count( $block_styles ) === 1, 'block styles must be present' );
$this->assertTrue( isset( $settings['color']['palette']['theme'] ), 'theme palette must be present' );
$this->assertTrue( isset( $settings['color']['palette']['custom'] ), 'user palette must be present' );

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

0 comments on commit 75c1202

Please sign in to comment.