From bd001e80dfcbba3fd343c1d0e5f25434b1231cdb Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 10 Oct 2022 15:57:11 +0000 Subject: [PATCH] Tests: Use `assertSame()` in some `WP_Theme_JSON` tests. This ensures that not only the return values match the expected results, but also that their type is the same. Previously committed in [54402], these instances appear to be accidentally reverted to `assertEquals()` in [54443]. Follow-up to [52275], [54162], [54402], [54443]. See #55654. git-svn-id: https://develop.svn.wordpress.org/trunk@54446 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/theme/wpThemeJson.php | 2 +- tests/phpunit/tests/theme/wpThemeJsonResolver.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/theme/wpThemeJson.php b/tests/phpunit/tests/theme/wpThemeJson.php index d11baa3455..56b1bec0e1 100644 --- a/tests/phpunit/tests/theme/wpThemeJson.php +++ b/tests/phpunit/tests/theme/wpThemeJson.php @@ -3411,7 +3411,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase { 'default' ); - $this->assertEquals( + $this->assertSame( 'body { margin: 0; }.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }.wp-site-blocks > * + * { margin-block-start: 1rem; }body { --wp--style--block-gap: 1rem; }body .is-layout-flow > *{margin-block-start: 0;margin-block-end: 0;}body .is-layout-flow > * + *{margin-block-start: 1rem;margin-block-end: 0;}body .is-layout-flex{gap: 1rem;}body .is-layout-flow > .alignleft{float: left;margin-inline-start: 0;margin-inline-end: 2em;}body .is-layout-flow > .alignright{float: right;margin-inline-start: 2em;margin-inline-end: 0;}body .is-layout-flow > .aligncenter{margin-left: auto !important;margin-right: auto !important;}body .is-layout-flex{display: flex;}body .is-layout-flex{flex-wrap: wrap;align-items: center;}.wp-block-post-content{color: gray;}.wp-block-social-links.is-layout-flow > *{margin-block-start: 0;margin-block-end: 0;}.wp-block-social-links.is-layout-flow > * + *{margin-block-start: 0;margin-block-end: 0;}.wp-block-social-links.is-layout-flex{gap: 0;}.wp-block-buttons.is-layout-flow > *{margin-block-start: 0;margin-block-end: 0;}.wp-block-buttons.is-layout-flow > * + *{margin-block-start: 0;margin-block-end: 0;}.wp-block-buttons.is-layout-flex{gap: 0;}', $theme_json->get_stylesheet() ); diff --git a/tests/phpunit/tests/theme/wpThemeJsonResolver.php b/tests/phpunit/tests/theme/wpThemeJsonResolver.php index 6c96305c43..9b43a4fb33 100644 --- a/tests/phpunit/tests/theme/wpThemeJsonResolver.php +++ b/tests/phpunit/tests/theme/wpThemeJsonResolver.php @@ -388,7 +388,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { WP_Theme_JSON_Resolver::clean_cached_data(); } $query_count = count( $this->queries ) - $query_count; - $this->assertEquals( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' ); + $this->assertSame( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' ); $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme ); $this->assertEmpty( $user_cpt ); @@ -403,7 +403,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { $this->assertSameSets( $user_cpt, $new_user_cpt ); } $query_count = count( $this->queries ) - $query_count; - $this->assertEquals( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' ); + $this->assertSame( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' ); remove_filter( 'query', array( $this, 'filter_db_query' ) ); }