From be4979662ef7009f0d410ad64898fd504dd53dc1 Mon Sep 17 00:00:00 2001 From: Matias Benedetto Date: Thu, 12 Oct 2023 11:52:07 -0300 Subject: [PATCH 1/2] fix warning on unit tests --- lib/class-wp-theme-json-gutenberg.php | 2 +- phpunit/class-wp-theme-json-test.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 8c2857fa89d0c..b2b3fa997b8cd 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -3389,7 +3389,7 @@ public function set_spacing_sizes() { || ! is_numeric( $spacing_scale['mediumStep'] ) || ( '+' !== $spacing_scale['operator'] && '*' !== $spacing_scale['operator'] ) ) { if ( ! empty( $spacing_scale ) ) { - trigger_error( __( 'Some of the theme.json settings.spacing.spacingScale values are invalid', 'gutenberg' ), E_USER_NOTICE ); + _doing_it_wrong( __METHOD__, __( 'Some of the theme.json settings.spacing.spacingScale values are invalid', 'gutenberg' ), '6.1.0' ); } return null; } diff --git a/phpunit/class-wp-theme-json-test.php b/phpunit/class-wp-theme-json-test.php index 0e212983d9080..54becb4234553 100644 --- a/phpunit/class-wp-theme-json-test.php +++ b/phpunit/class-wp-theme-json-test.php @@ -1282,9 +1282,8 @@ public function data_generate_spacing_scale_fixtures() { * @dataProvider data_set_spacing_sizes_when_invalid */ public function test_set_spacing_sizes_when_invalid( $spacing_scale, $expected_output ) { - $this->expectNotice(); - $this->expectNoticeMessage( 'Some of the theme.json settings.spacing.spacingScale values are invalid' ); - + $this->setExpectedIncorrectUsage( 'WP_Theme_JSON_Gutenberg::set_spacing_sizes' ); + $theme_json = new WP_Theme_JSON_Gutenberg( array( 'version' => 2, From ba34bf9a46d1120edc668e983dd64d6d8cd70ecf Mon Sep 17 00:00:00 2001 From: Matias Benedetto Date: Thu, 12 Oct 2023 12:02:51 -0300 Subject: [PATCH 2/2] php format --- phpunit/class-wp-theme-json-test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit/class-wp-theme-json-test.php b/phpunit/class-wp-theme-json-test.php index 54becb4234553..35747a290ca74 100644 --- a/phpunit/class-wp-theme-json-test.php +++ b/phpunit/class-wp-theme-json-test.php @@ -1283,7 +1283,7 @@ public function data_generate_spacing_scale_fixtures() { */ public function test_set_spacing_sizes_when_invalid( $spacing_scale, $expected_output ) { $this->setExpectedIncorrectUsage( 'WP_Theme_JSON_Gutenberg::set_spacing_sizes' ); - + $theme_json = new WP_Theme_JSON_Gutenberg( array( 'version' => 2,