diff --git a/tests/phpunit/tests/admin/includesUser.php b/tests/phpunit/tests/admin/includesUser.php index 4e0d99c639..0b590377e9 100644 --- a/tests/phpunit/tests/admin/includesUser.php +++ b/tests/phpunit/tests/admin/includesUser.php @@ -17,7 +17,7 @@ class Tests_Admin_IncludesUser extends WP_UnitTestCase { if ( $error_code ) { $this->assertWPError( $error ); - $this->assertEquals( $error_code, $error->get_error_code() ); + $this->assertSame( $error_code, $error->get_error_code() ); } else { $this->assertNotWPError( $error ); } diff --git a/tests/phpunit/tests/ajax/CustomizeManager.php b/tests/phpunit/tests/ajax/CustomizeManager.php index 6116aea2c4..7cf71d1df9 100644 --- a/tests/phpunit/tests/ajax/CustomizeManager.php +++ b/tests/phpunit/tests/ajax/CustomizeManager.php @@ -132,7 +132,7 @@ class Tests_Ajax_CustomizeManager extends WP_Ajax_UnitTestCase { $exception = $e; } $this->assertNotEmpty( $e ); - $this->assertEquals( -1, $e->getMessage() ); + $this->assertSame( '-1', $e->getMessage() ); // Not called setup_theme. wp_set_current_user( self::$admin_user_id ); diff --git a/tests/phpunit/tests/block-template-utils.php b/tests/phpunit/tests/block-template-utils.php index 7410dcaed3..440dbc15d9 100644 --- a/tests/phpunit/tests/block-template-utils.php +++ b/tests/phpunit/tests/block-template-utils.php @@ -208,7 +208,7 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase { * @dataProvider data_remove_theme_attribute_in_block_template_content */ function test_remove_theme_attribute_in_block_template_content( $template_content, $expected ) { - $this->assertEquals( $expected, _remove_theme_attribute_in_block_template_content( $template_content ) ); + $this->assertSame( $expected, _remove_theme_attribute_in_block_template_content( $template_content ) ); } function data_remove_theme_attribute_in_block_template_content() { diff --git a/tests/phpunit/tests/blocks/wpBlockType.php b/tests/phpunit/tests/blocks/wpBlockType.php index 28eb8f1edf..8ba94be4f5 100644 --- a/tests/phpunit/tests/blocks/wpBlockType.php +++ b/tests/phpunit/tests/blocks/wpBlockType.php @@ -240,7 +240,7 @@ class Tests_Blocks_wpBlockType extends WP_UnitTestCase { $prepared_attributes = $block_type->prepare_attributes_for_render( $attributes ); - $this->assertEquals( + $this->assertSameSetsWithIndex( array( 'correct' => 'include', /* wrongType */ diff --git a/tests/phpunit/tests/comment/getCommentsPagesCount.php b/tests/phpunit/tests/comment/getCommentsPagesCount.php index 00a5244f3a..a3c815f8c4 100644 --- a/tests/phpunit/tests/comment/getCommentsPagesCount.php +++ b/tests/phpunit/tests/comment/getCommentsPagesCount.php @@ -174,9 +174,9 @@ class Tests_Comment_GetCommentsPagesCount extends WP_UnitTestCase { $wp_query->max_num_comment_pages = 7; - $this->assertEquals( 7, get_comment_pages_count() ); - $this->assertEquals( 7, get_comment_pages_count( null, null, null ) ); - $this->assertEquals( 0, get_comment_pages_count( array(), null, null ) ); + $this->assertSame( 7, get_comment_pages_count() ); + $this->assertSame( 7, get_comment_pages_count( null, null, null ) ); + $this->assertSame( 0, get_comment_pages_count( array(), null, null ) ); $wp_query->max_num_comment_pages = $org_max_num_comment_pages; } diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php index 94b13192d5..15c23bd1a6 100644 --- a/tests/phpunit/tests/comment/query.php +++ b/tests/phpunit/tests/comment/query.php @@ -4021,7 +4021,7 @@ class Tests_Comment_Query extends WP_UnitTestCase { ) ); - $this->assertEquals( 3, $q->found_comments ); + $this->assertSame( 3, $q->found_comments ); $this->assertEquals( 2, $q->max_num_pages ); } diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index df6679ebc7..96aa37f889 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -2533,10 +2533,10 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase { $this->assertSame( $default_value, $this->manager->post_value( $setting, $default_value ) ); $this->assertSame( $default_value, $setting->post_value( $default_value ) ); - $post_value = '42'; - $this->manager->set_post_value( 'numeric', $post_value ); - $this->assertEquals( $post_value, $this->manager->post_value( $setting, $default_value ) ); - $this->assertEquals( $post_value, $setting->post_value( $default_value ) ); + $post_value = 42; + $this->manager->set_post_value( 'numeric', (string) $post_value ); + $this->assertSame( $post_value, $this->manager->post_value( $setting, $default_value ) ); + $this->assertSame( $post_value, $setting->post_value( $default_value ) ); } /** diff --git a/tests/phpunit/tests/customize/selective-refresh-ajax.php b/tests/phpunit/tests/customize/selective-refresh-ajax.php index 541ca23b27..040697d419 100644 --- a/tests/phpunit/tests/customize/selective-refresh-ajax.php +++ b/tests/phpunit/tests/customize/selective-refresh-ajax.php @@ -188,8 +188,6 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase { ) ); - $count_customize_render_partials_before = has_action( 'customize_render_partials_before' ); - $count_customize_render_partials_after = has_action( 'customize_render_partials_after' ); ob_start(); try { $this->expected_partial_ids = array( 'foo' ); @@ -200,8 +198,8 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase { } catch ( WPDieException $e ) { $this->assertSame( '', $e->getMessage() ); } - $this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) ); - $this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) ); + $this->assertTrue( has_action( 'customize_render_partials_before' ) ); + $this->assertTrue( has_action( 'customize_render_partials_after' ) ); $output = json_decode( ob_get_clean(), true ); $this->assertSame( array( false ), $output['data']['contents']['foo'] ); } @@ -326,8 +324,6 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase { ) ); - $count_customize_render_partials_before = has_action( 'customize_render_partials_before' ); - $count_customize_render_partials_after = has_action( 'customize_render_partials_after' ); ob_start(); try { $this->expected_partial_ids = array( 'test_blogname' ); @@ -338,8 +334,8 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase { } catch ( WPDieException $e ) { $this->assertSame( '', $e->getMessage() ); } - $this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) ); - $this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) ); + $this->assertTrue( has_action( 'customize_render_partials_before' ) ); + $this->assertTrue( has_action( 'customize_render_partials_after' ) ); $output = json_decode( ob_get_clean(), true ); $this->assertSame( array( get_bloginfo( 'name', 'display' ) ), $output['data']['contents']['test_blogname'] ); $this->assertArrayHasKey( 'setting_validities', $output['data'] ); @@ -435,8 +431,6 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase { ) ); - $count_customize_render_partials_before = has_action( 'customize_render_partials_before' ); - $count_customize_render_partials_after = has_action( 'customize_render_partials_after' ); ob_start(); try { $this->expected_partial_ids = array( 'test_dynamic_blogname' ); @@ -447,8 +441,8 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase { } catch ( WPDieException $e ) { $this->assertSame( '', $e->getMessage() ); } - $this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) ); - $this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) ); + $this->assertTrue( has_action( 'customize_render_partials_before' ) ); + $this->assertTrue( has_action( 'customize_render_partials_after' ) ); $output = json_decode( ob_get_clean(), true ); $this->assertSame( array( get_bloginfo( 'name', 'display' ) ), $output['data']['contents']['test_dynamic_blogname'] ); } @@ -487,8 +481,6 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase { ) ); - $count_customize_render_partials_before = has_action( 'customize_render_partials_before' ); - $count_customize_render_partials_after = has_action( 'customize_render_partials_after' ); ob_start(); try { $this->expected_partial_ids = array( 'test_blogname', 'test_blogdescription' ); @@ -499,8 +491,8 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase { } catch ( WPDieException $e ) { $this->assertSame( '', $e->getMessage() ); } - $this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) ); - $this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) ); + $this->assertTrue( has_action( 'customize_render_partials_before' ) ); + $this->assertTrue( has_action( 'customize_render_partials_after' ) ); $output = json_decode( ob_get_clean(), true ); $this->assertSame( array( get_bloginfo( 'name', 'display' ) ), $output['data']['contents']['test_blogname'] ); $this->assertSame( array_fill( 0, 2, get_bloginfo( 'description', 'display' ) ), $output['data']['contents']['test_blogdescription'] ); diff --git a/tests/phpunit/tests/formatting/mapDeep.php b/tests/phpunit/tests/formatting/mapDeep.php index c309805c27..0b60ae99bf 100644 --- a/tests/phpunit/tests/formatting/mapDeep.php +++ b/tests/phpunit/tests/formatting/mapDeep.php @@ -49,7 +49,7 @@ class Tests_Formatting_MapDeep extends WP_UnitTestCase { } public function test_map_deep_should_map_each_object_element_of_an_array() { - $this->assertEquals( + $this->assertEqualSets( array( 'var0' => 'ababa', 'var1' => (object) array( diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index a7679be7f0..14d2a26315 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -2056,9 +2056,9 @@ class Tests_Functions extends WP_UnitTestCase { * @ticket 53668 */ public function test_wp_get_default_extension_for_mime_type() { - $this->assertEquals( 'jpg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpg not returned as default extension for "image/jpeg"' ); + $this->assertSame( 'jpg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpg not returned as default extension for "image/jpeg"' ); $this->assertNotEquals( 'jpeg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpeg should not be returned as default extension for "image/jpeg"' ); - $this->assertEquals( 'png', wp_get_default_extension_for_mime_type( 'image/png' ), 'png not returned as default extension for "image/png"' ); + $this->assertSame( 'png', wp_get_default_extension_for_mime_type( 'image/png' ), 'png not returned as default extension for "image/png"' ); $this->assertFalse( wp_get_default_extension_for_mime_type( 'wibble/wobble' ), 'false not returned for unrecognized mime type' ); $this->assertFalse( wp_get_default_extension_for_mime_type( '' ), 'false not returned when empty string as mime type supplied' ); $this->assertFalse( wp_get_default_extension_for_mime_type( ' ' ), 'false not returned when empty string as mime type supplied' ); @@ -2072,7 +2072,7 @@ class Tests_Functions extends WP_UnitTestCase { */ function test_wp_filesize_with_nonexistent_file() { $file = 'nonexistent/file.jpg'; - $this->assertEquals( 0, wp_filesize( $file ) ); + $this->assertSame( 0, wp_filesize( $file ) ); } /** @@ -2082,7 +2082,7 @@ class Tests_Functions extends WP_UnitTestCase { function test_wp_filesize() { $file = DIR_TESTDATA . '/images/test-image-upside-down.jpg'; - $this->assertEquals( filesize( $file ), wp_filesize( $file ) ); + $this->assertSame( filesize( $file ), wp_filesize( $file ) ); $filter = function() { return 999; @@ -2090,7 +2090,7 @@ class Tests_Functions extends WP_UnitTestCase { add_filter( 'wp_filesize', $filter ); - $this->assertEquals( 999, wp_filesize( $file ) ); + $this->assertSame( 999, wp_filesize( $file ) ); $pre_filter = function() { return 111; @@ -2098,7 +2098,7 @@ class Tests_Functions extends WP_UnitTestCase { add_filter( 'pre_wp_filesize', $pre_filter ); - $this->assertEquals( 111, wp_filesize( $file ) ); + $this->assertSame( 111, wp_filesize( $file ) ); } /** @@ -2184,7 +2184,7 @@ class Tests_Functions extends WP_UnitTestCase { ), 'version' => 1, ); - $this->assertEquals( $theme_json, $expected_theme_json ); + $this->assertSameSetsWithIndex( $theme_json, $expected_theme_json ); } } diff --git a/tests/phpunit/tests/import/import.php b/tests/phpunit/tests/import/import.php index 0f4412fe11..2162824e96 100644 --- a/tests/phpunit/tests/import/import.php +++ b/tests/phpunit/tests/import/import.php @@ -62,8 +62,8 @@ class Tests_Import_Import extends WP_Import_UnitTestCase { $this->assertSame( 'author@example.org', $author->user_email ); // Check that terms were imported correctly. - $this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) ); - $this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) ); + $this->assertSame( '30', wp_count_terms( array( 'taxonomy' => 'category' ) ) ); + $this->assertSame( '3', wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) ); $foo = get_term_by( 'slug', 'foo', 'category' ); $this->assertSame( 0, $foo->parent ); $bar = get_term_by( 'slug', 'bar', 'category' ); @@ -72,11 +72,11 @@ class Tests_Import_Import extends WP_Import_UnitTestCase { // Check that posts/pages were imported correctly. $post_count = wp_count_posts( 'post' ); - $this->assertEquals( 5, $post_count->publish ); - $this->assertEquals( 1, $post_count->private ); + $this->assertSame( '5', $post_count->publish ); + $this->assertSame( '1', $post_count->private ); $page_count = wp_count_posts( 'page' ); - $this->assertEquals( 4, $page_count->publish ); - $this->assertEquals( 1, $page_count->draft ); + $this->assertSame( '4', $page_count->publish ); + $this->assertSame( '1', $page_count->draft ); $comment_count = wp_count_comments(); $this->assertSame( 1, $comment_count->total_comments ); @@ -230,8 +230,8 @@ class Tests_Import_Import extends WP_Import_UnitTestCase { $this->assertSame( 'author', $author->user_login ); $this->assertSame( 'author@example.org', $author->user_email ); - $this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) ); - $this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) ); + $this->assertSame( '30', wp_count_terms( array( 'taxonomy' => 'category' ) ) ); + $this->assertSame( '3', wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) ); $foo = get_term_by( 'slug', 'foo', 'category' ); $this->assertSame( 0, $foo->parent ); $bar = get_term_by( 'slug', 'bar', 'category' ); @@ -239,11 +239,11 @@ class Tests_Import_Import extends WP_Import_UnitTestCase { $this->assertSame( $bar->term_id, $foo_bar->parent ); $post_count = wp_count_posts( 'post' ); - $this->assertEquals( 5, $post_count->publish ); - $this->assertEquals( 1, $post_count->private ); + $this->assertSame( '5', $post_count->publish ); + $this->assertSame( '1', $post_count->private ); $page_count = wp_count_posts( 'page' ); - $this->assertEquals( 4, $page_count->publish ); - $this->assertEquals( 1, $page_count->draft ); + $this->assertSame( '4', $page_count->publish ); + $this->assertSame( '1', $page_count->draft ); $comment_count = wp_count_comments(); $this->assertSame( 1, $comment_count->total_comments ); } diff --git a/tests/phpunit/tests/import/parser.php b/tests/phpunit/tests/import/parser.php index 76dc3c1972..2c05bb8f35 100644 --- a/tests/phpunit/tests/import/parser.php +++ b/tests/phpunit/tests/import/parser.php @@ -74,7 +74,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase { $this->assertIsArray( $result, $message ); $this->assertSame( 'http://localhost/', $result['base_url'], $message ); - $this->assertEquals( + $this->assertEqualSetsWithIndex( array( 'author_id' => 2, 'author_login' => 'john', @@ -86,7 +86,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase { $result['authors']['john'], $message ); - $this->assertEquals( + $this->assertEqualSetsWithIndex( array( 'term_id' => 3, 'category_nicename' => 'alpha', @@ -97,7 +97,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase { $result['categories'][0], $message ); - $this->assertEquals( + $this->assertEqualSetsWithIndex( array( 'term_id' => 22, 'tag_slug' => 'clippable', @@ -107,7 +107,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase { $result['tags'][0], $message ); - $this->assertEquals( + $this->assertEqualSetsWithIndex( array( 'term_id' => 40, 'term_taxonomy' => 'post_tax', @@ -123,7 +123,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase { $this->assertCount( 2, $result['posts'], $message ); $this->assertCount( 19, $result['posts'][0], $message ); $this->assertCount( 18, $result['posts'][1], $message ); - $this->assertEquals( + $this->assertEqualSetsWithIndex( array( array( 'name' => 'alpha', diff --git a/tests/phpunit/tests/import/postmeta.php b/tests/phpunit/tests/import/postmeta.php index bbe10deca9..a7eb6bc9d3 100644 --- a/tests/phpunit/tests/import/postmeta.php +++ b/tests/phpunit/tests/import/postmeta.php @@ -76,7 +76,7 @@ class Tests_Import_Postmeta extends WP_Import_UnitTestCase { $classy->tag = 'wscript'; $expected[] = $classy; - $this->assertEquals( $expected, get_post_meta( 150, 'test', true ) ); + $this->assertEqualSets( $expected, get_post_meta( 150, 'test', true ) ); } /** diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 7421a2bdeb..820da7ed3d 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -501,7 +501,7 @@ https://w.org', ); $images = get_attached_media( 'image', $post_id ); - $this->assertEquals( $images, array( $attachment_id => get_post( $attachment_id ) ) ); + $this->assertEqualSets( $images, array( $attachment_id => get_post( $attachment_id ) ) ); } /** diff --git a/tests/phpunit/tests/multisite/network.php b/tests/phpunit/tests/multisite/network.php index db5cfb25ca..a2f0dee8d9 100644 --- a/tests/phpunit/tests/multisite/network.php +++ b/tests/phpunit/tests/multisite/network.php @@ -171,7 +171,7 @@ if ( is_multisite() ) : } wp_update_network_counts(); - $this->assertEquals( $site_count_start, $actual ); + $this->assertSame( $site_count_start, $actual ); } /** @@ -191,7 +191,7 @@ if ( is_multisite() ) : } wp_update_network_counts(); - $this->assertEquals( $site_count_start + 1, $actual ); + $this->assertSame( $site_count_start + 1, $actual ); } /** @@ -202,11 +202,9 @@ if ( is_multisite() ) : $site_count = get_blog_count( self::$different_network_id ); - $this->assertEquals( count( self::$different_site_ids ), $site_count ); + $this->assertSame( count( self::$different_site_ids ), $site_count ); } - - public function test_active_network_plugins() { $path = 'hello.php'; diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php index 58057feef2..86ad14ad52 100644 --- a/tests/phpunit/tests/multisite/site.php +++ b/tests/phpunit/tests/multisite/site.php @@ -1555,9 +1555,9 @@ if ( is_multisite() ) : $result = wp_update_site( $site_id, array( 'public' => 1 ) ); $site3 = get_site( $site_id ); - $this->assertEquals( 1, $site1->public ); - $this->assertEquals( 0, $site2->public ); - $this->assertEquals( 1, $site3->public ); + $this->assertSame( '1', $site1->public ); + $this->assertSame( '0', $site2->public ); + $this->assertSame( '1', $site3->public ); } /** @@ -2433,7 +2433,7 @@ if ( is_multisite() ) : wpmu_create_blog( 'testsite1.example.org', '/new-blog/', 'New Blog', get_current_user_id(), $meta, 1 ); - $this->assertEquals( $expected_meta, $this->wp_initialize_site_meta ); + $this->assertSameSetsWithIndex( $expected_meta, $this->wp_initialize_site_meta ); $this->wp_initialize_site_meta = array(); } @@ -2534,8 +2534,8 @@ if ( is_multisite() ) : ), array( 'public' => 0, - 'WPLANG' => 'en_US', 'foo' => 'bar', + 'WPLANG' => 'en_US', ), ), ); diff --git a/tests/phpunit/tests/option/networkOption.php b/tests/phpunit/tests/option/networkOption.php index 2231ecf0fa..0c39867109 100644 --- a/tests/phpunit/tests/option/networkOption.php +++ b/tests/phpunit/tests/option/networkOption.php @@ -176,7 +176,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase { $this->assertIsInt( add_metadata( 'site', $network_id, $option, $funky_meta, true ) ); // Check they exists. - $this->assertEquals( $funky_meta, get_network_option( $network_id, $option ) ); + $this->assertEqualSets( $funky_meta, get_network_option( $network_id, $option ) ); } /** @@ -190,7 +190,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase { add_metadata( 'site', $network_id, $option, 'monday', true ); add_metadata( 'site', $network_id, $option, 'tuesday', true ); add_metadata( 'site', $network_id, $option, 'wednesday', true ); - $this->assertEquals( 'monday', get_network_option( $network_id, $option, true ) ); + $this->assertSame( 'monday', get_network_option( $network_id, $option, true ) ); } /** @@ -279,7 +279,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase { ); add_metadata( 'site', $network_id, $option, $array_w_object, true ); - $this->assertEquals( $array_w_object, get_network_option( $network_id, $option ) ); + $this->assertEqualSets( $array_w_object, get_network_option( $network_id, $option ) ); } /** diff --git a/tests/phpunit/tests/post/getPages.php b/tests/phpunit/tests/post/getPages.php index 5797e81005..804f4b431b 100644 --- a/tests/phpunit/tests/post/getPages.php +++ b/tests/phpunit/tests/post/getPages.php @@ -424,7 +424,7 @@ class Tests_Post_GetPages extends WP_UnitTestCase { ) ); // Confirm the defaults. - $this->assertEquals( $pages, $pages_default_args ); + $this->assertEqualSets( $pages, $pages_default_args ); /* * Here's the tree we are testing: @@ -468,7 +468,7 @@ class Tests_Post_GetPages extends WP_UnitTestCase { ) ); - $this->assertEquals( $pages, $default_args ); + $this->assertEqualSets( $pages, $default_args ); /* * Page tree: diff --git a/tests/phpunit/tests/post/meta.php b/tests/phpunit/tests/post/meta.php index ad391e741f..456eda0ba1 100644 --- a/tests/phpunit/tests/post/meta.php +++ b/tests/phpunit/tests/post/meta.php @@ -248,7 +248,7 @@ class Tests_Post_Meta extends WP_UnitTestCase { $this->assertIsInt( add_post_meta( self::$post_id, 'test_funky_post_meta', $funky_meta, true ) ); // Check it exists. - $this->assertEquals( $funky_meta, get_post_meta( self::$post_id, 'test_funky_post_meta', true ) ); + $this->assertEqualSets( $funky_meta, get_post_meta( self::$post_id, 'test_funky_post_meta', true ) ); } diff --git a/tests/phpunit/tests/post/wpInsertPost.php b/tests/phpunit/tests/post/wpInsertPost.php index 4ec43bbfec..05a24453e3 100644 --- a/tests/phpunit/tests/post/wpInsertPost.php +++ b/tests/phpunit/tests/post/wpInsertPost.php @@ -900,7 +900,7 @@ class Tests_Post_wpInsertPost extends WP_UnitTestCase { // Validate that the term got assigned. $assigned_terms = wp_get_object_terms( array( $post_id ), array( 'category' ), array() ); $this->assertCount( 1, $assigned_terms ); - $this->assertEquals( $term_id, $assigned_terms[0]->term_id ); + $this->assertSame( $term_id, $assigned_terms[0]->term_id ); // Update the post with no changes. $post = get_post( $post_id ); @@ -909,7 +909,7 @@ class Tests_Post_wpInsertPost extends WP_UnitTestCase { // Validate the term is still assigned. $assigned_terms = wp_get_object_terms( array( $post_id ), array( 'category' ), array() ); $this->assertCount( 1, $assigned_terms ); - $this->assertEquals( $term_id, $assigned_terms[0]->term_id ); + $this->assertSame( $term_id, $assigned_terms[0]->term_id ); // Remove the term from the post. $post->post_category = array(); diff --git a/tests/phpunit/tests/query/date.php b/tests/phpunit/tests/query/date.php index d54f8af77c..978368674a 100644 --- a/tests/phpunit/tests/query/date.php +++ b/tests/phpunit/tests/query/date.php @@ -298,7 +298,7 @@ class Tests_Query_Date extends WP_UnitTestCase { ) ); - $this->assertEquals( $expected, $posts ); + $this->assertEqualSets( $expected, $posts ); } public function test_simple_monthnum_expecting_results() { diff --git a/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php b/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php index 9f2401e893..71d02d4832 100644 --- a/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php +++ b/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php @@ -421,7 +421,7 @@ class REST_Block_Renderer_Controller_Test extends WP_Test_REST_Controller_Testca $data = $response->get_data(); $this->assertSame( $expected_attributes, json_decode( $data['rendered'], true ) ); - $this->assertEquals( + $this->assertEqualSetsWithIndex( json_decode( $block_type->render( $attributes ), true ), json_decode( $data['rendered'], true ) ); diff --git a/tests/phpunit/tests/rest-api/rest-global-styles-controller.php b/tests/phpunit/tests/rest-api/rest-global-styles-controller.php index 0c27723a1c..b7a5617a11 100644 --- a/tests/phpunit/tests/rest-api/rest-global-styles-controller.php +++ b/tests/phpunit/tests/rest-api/rest-global-styles-controller.php @@ -371,7 +371,7 @@ class WP_REST_Global_Styles_Controller_Test extends WP_Test_REST_Controller_Test $data = $response->get_data(); $links = $response->get_links(); - $this->assertEquals( + $this->assertEqualSets( array( 'id' => self::$global_styles_id, 'title' => array( @@ -409,7 +409,7 @@ class WP_REST_Global_Styles_Controller_Test extends WP_Test_REST_Controller_Test ); $response = rest_get_server()->dispatch( $request ); $data = $response->get_data(); - $this->assertEquals( 'My new global styles title', $data['title']['raw'] ); + $this->assertSame( 'My new global styles title', $data['title']['raw'] ); } diff --git a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php index ebce49a7f3..cc804a80fc 100644 --- a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php +++ b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php @@ -2797,7 +2797,7 @@ class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase { $response = rest_get_server()->dispatch( $request ); $this->assertSame( 200, $response->get_status() ); - $this->assertEquals( array( 0 ), $response->get_data()['meta']['multi_boolean'] ); + $this->assertSameSetsWithIndex( array( false ), $response->get_data()['meta']['multi_boolean'] ); $this->assertFalse( get_metadata_by_mid( 'post', $mid1 ) ); $this->assertNotFalse( get_metadata_by_mid( 'post', $mid2 ) ); diff --git a/tests/phpunit/tests/rest-api/rest-site-health-controller.php b/tests/phpunit/tests/rest-api/rest-site-health-controller.php index ddc932709d..899308d745 100644 --- a/tests/phpunit/tests/rest-api/rest-site-health-controller.php +++ b/tests/phpunit/tests/rest-api/rest-site-health-controller.php @@ -116,12 +116,12 @@ class WP_Test_REST_Site_Health_Controller extends WP_Test_REST_TestCase { $this->assertCount( 1, $route ); $route = current( $route ); - $this->assertEquals( + $this->assertSame( array( WP_REST_Server::READABLE => true ), $route['methods'] ); - $this->assertEquals( + $this->assertSame( 'test_page_cache', $route['callback'][1] ); diff --git a/tests/phpunit/tests/rest-api/rest-themes-controller.php b/tests/phpunit/tests/rest-api/rest-themes-controller.php index 0492f191fe..eb2b379c66 100644 --- a/tests/phpunit/tests/rest-api/rest-themes-controller.php +++ b/tests/phpunit/tests/rest-api/rest-themes-controller.php @@ -628,7 +628,7 @@ class WP_Test_REST_Themes_Controller extends WP_Test_REST_Controller_Testcase { $result = $response->get_data(); $this->assertArrayHasKey( 'theme_supports', $result[0] ); $this->assertArrayHasKey( 'editor-font-sizes', $result[0]['theme_supports'] ); - $this->assertEquals( array( $tiny ), $result[0]['theme_supports']['editor-font-sizes'] ); + $this->assertEqualSetsWithIndex( array( $tiny ), $result[0]['theme_supports']['editor-font-sizes'] ); } /** diff --git a/tests/phpunit/tests/rest-api/wpRestTemplatesController.php b/tests/phpunit/tests/rest-api/wpRestTemplatesController.php index 0ddd023c01..fa790b66d1 100644 --- a/tests/phpunit/tests/rest-api/wpRestTemplatesController.php +++ b/tests/phpunit/tests/rest-api/wpRestTemplatesController.php @@ -343,7 +343,7 @@ class Tests_REST_WpRestTemplatesController extends WP_Test_REST_Controller_Testc */ public function test_sanitize_template_id( $input_id, $sanitized_id ) { $endpoint = new WP_REST_Templates_Controller( 'wp_template' ); - $this->assertEquals( + $this->assertSame( $sanitized_id, $endpoint->_sanitize_template_id( $input_id ) ); diff --git a/tests/phpunit/tests/style-engine/wpStyleEngineCssRulesStore.php b/tests/phpunit/tests/style-engine/wpStyleEngineCssRulesStore.php index 559c0b3492..4fe6c4c6e2 100644 --- a/tests/phpunit/tests/style-engine/wpStyleEngineCssRulesStore.php +++ b/tests/phpunit/tests/style-engine/wpStyleEngineCssRulesStore.php @@ -88,7 +88,7 @@ class Tests_Style_Engine_wpStyleEngineCSSRulesStore extends WP_UnitTestCase { $burrito_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'burrito' ); $quesadilla_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'quesadilla' ); - $this->assertEquals( + $this->assertSame( array( 'burrito' => $burrito_store, 'quesadilla' => $quesadilla_store, @@ -108,7 +108,7 @@ class Tests_Style_Engine_wpStyleEngineCSSRulesStore extends WP_UnitTestCase { $dolmades_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'dolmades' ); $tzatziki_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'tzatziki' ); - $this->assertEquals( + $this->assertSame( array( 'dolmades' => $dolmades_store, 'tzatziki' => $tzatziki_store, @@ -119,7 +119,7 @@ class Tests_Style_Engine_wpStyleEngineCSSRulesStore extends WP_UnitTestCase { WP_Style_Engine_CSS_Rules_Store::remove_all_stores(); - $this->assertEquals( + $this->assertSame( array(), WP_Style_Engine_CSS_Rules_Store::get_stores(), 'Return value of get_stores() is not an empty array after remove_all_stores() called.' diff --git a/tests/phpunit/tests/term.php b/tests/phpunit/tests/term.php index 3e9c0a25f5..09235e25b9 100644 --- a/tests/phpunit/tests/term.php +++ b/tests/phpunit/tests/term.php @@ -75,7 +75,7 @@ class Tests_Term extends WP_UnitTestCase { ) ); // There are 5 posts, all Uncategorized. - $this->assertEquals( 1, $count ); + $this->assertSame( '1', $count ); } /** @@ -86,14 +86,14 @@ class Tests_Term extends WP_UnitTestCase { // Counts all terms (1 default category, 5 tags). $count = wp_count_terms(); - $this->assertEquals( 6, $count ); + $this->assertSame( '6', $count ); // Counts only tags (5), with both current and legacy signature. // Legacy usage should not trigger deprecated notice. $count = wp_count_terms( array( 'taxonomy' => 'post_tag' ) ); $legacy_count = wp_count_terms( 'post_tag' ); - $this->assertEquals( 5, $count ); - $this->assertEquals( $count, $legacy_count ); + $this->assertSame( '5', $count ); + $this->assertSame( $count, $legacy_count ); } /** @@ -159,7 +159,7 @@ class Tests_Term extends WP_UnitTestCase { $this->assertIsNumeric( $t ); $this->assertNotWPError( $t ); $this->assertGreaterThan( 0, $t ); - $this->assertEquals( $initial_count + 1, wp_count_terms( array( 'taxonomy' => 'category' ) ) ); + $this->assertSame( (string) ( $initial_count + 1 ), wp_count_terms( array( 'taxonomy' => 'category' ) ) ); // Make sure the term exists. $this->assertGreaterThan( 0, term_exists( $term ) ); @@ -169,7 +169,7 @@ class Tests_Term extends WP_UnitTestCase { $this->assertTrue( wp_delete_category( $t ) ); $this->assertNull( term_exists( $term ) ); $this->assertNull( term_exists( $t ) ); - $this->assertEquals( $initial_count, wp_count_terms( array( 'taxonomy' => 'category' ) ) ); + $this->assertSame( $initial_count, wp_count_terms( array( 'taxonomy' => 'category' ) ) ); } /** diff --git a/tests/phpunit/tests/term/getTerms.php b/tests/phpunit/tests/term/getTerms.php index 9b4bc16640..5c0d67f72e 100644 --- a/tests/phpunit/tests/term/getTerms.php +++ b/tests/phpunit/tests/term/getTerms.php @@ -255,7 +255,7 @@ class Tests_Term_getTerms extends WP_UnitTestCase { 'fields' => 'id=>parent', ) ); - $this->assertEquals( + $this->assertSameSetsWithIndex( array( $term_id1 => 0, $term_id2 => $term_id1, @@ -288,7 +288,7 @@ class Tests_Term_getTerms extends WP_UnitTestCase { 'fields' => 'id=>name', ) ); - $this->assertEquals( + $this->assertSameSetsWithIndex( array( $term_id1 => 'WOO!', $term_id2 => 'HOO!', @@ -303,7 +303,7 @@ class Tests_Term_getTerms extends WP_UnitTestCase { 'fields' => 'id=>slug', ) ); - $this->assertEquals( + $this->assertSameSetsWithIndex( array( $term_id1 => 'woo', $term_id2 => 'hoo', diff --git a/tests/phpunit/tests/term/taxQuery.php b/tests/phpunit/tests/term/taxQuery.php index 78f88a58bb..e95027cb22 100644 --- a/tests/phpunit/tests/term/taxQuery.php +++ b/tests/phpunit/tests/term/taxQuery.php @@ -59,7 +59,7 @@ class Tests_Term_Tax_Query extends WP_UnitTestCase { 'operator' => 'IN', ); - $this->assertEquals( $expected, $tq->queries[0] ); + $this->assertSameSetsWithIndex( $expected, $tq->queries[0] ); } public function test_construct_fill_missing_query_params_merge_with_passed_values() { @@ -82,7 +82,7 @@ class Tests_Term_Tax_Query extends WP_UnitTestCase { 'foo' => 'bar', ); - $this->assertEquals( $expected, $tq->queries[0] ); + $this->assertSameSetsWithIndex( $expected, $tq->queries[0] ); } public function test_construct_cast_terms_to_array() { @@ -262,7 +262,7 @@ class Tests_Term_Tax_Query extends WP_UnitTestCase { ); $tq->transform_query( $tq->queries[0], 'term_taxonomy_id' ); - $this->assertEquals( $tt_ids, $tq->queries[0]['terms'] ); + $this->assertEqualSets( $tt_ids, $tq->queries[0]['terms'] ); $this->assertSame( 'term_taxonomy_id', $tq->queries[0]['field'] ); } diff --git a/tests/phpunit/tests/theme/wpThemeJson.php b/tests/phpunit/tests/theme/wpThemeJson.php index 1eb8bb4f6e..c3525ec236 100644 --- a/tests/phpunit/tests/theme/wpThemeJson.php +++ b/tests/phpunit/tests/theme/wpThemeJson.php @@ -676,6 +676,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase { '.has-grey-color{color: var(--wp--preset--color--grey) !important;}.has-dark-grey-color{color: var(--wp--preset--color--dark-grey) !important;}.has-light-grey-color{color: var(--wp--preset--color--light-grey) !important;}.has-white-2-black-color{color: var(--wp--preset--color--white-2-black) !important;}.has-grey-background-color{background-color: var(--wp--preset--color--grey) !important;}.has-dark-grey-background-color{background-color: var(--wp--preset--color--dark-grey) !important;}.has-light-grey-background-color{background-color: var(--wp--preset--color--light-grey) !important;}.has-white-2-black-background-color{background-color: var(--wp--preset--color--white-2-black) !important;}.has-grey-border-color{border-color: var(--wp--preset--color--grey) !important;}.has-dark-grey-border-color{border-color: var(--wp--preset--color--dark-grey) !important;}.has-light-grey-border-color{border-color: var(--wp--preset--color--light-grey) !important;}.has-white-2-black-border-color{border-color: var(--wp--preset--color--white-2-black) !important;}', $theme_json->get_stylesheet( array( 'presets' ) ) ); + $this->assertSame( 'body{--wp--preset--color--grey: grey;--wp--preset--color--dark-grey: grey;--wp--preset--color--light-grey: grey;--wp--preset--color--white-2-black: grey;--wp--custom--white-2-black: value;}', $theme_json->get_stylesheet( array( 'variables' ) ) @@ -3352,7 +3353,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 aa9c339e58..b68c6863f7 100644 --- a/tests/phpunit/tests/theme/wpThemeJsonResolver.php +++ b/tests/phpunit/tests/theme/wpThemeJsonResolver.php @@ -366,7 +366,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 ); @@ -381,7 +381,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' ) ); } diff --git a/tests/phpunit/tests/user.php b/tests/phpunit/tests/user.php index 4efb134c05..7157a00cfa 100644 --- a/tests/phpunit/tests/user.php +++ b/tests/phpunit/tests/user.php @@ -560,21 +560,21 @@ class Tests_User extends WP_UnitTestCase { wp_set_current_user( self::$author_id ); $counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', false ); - $this->assertEquals( 1, $counts[ self::$author_id ] ); - $this->assertEquals( 1, $counts[ $user_id_b ] ); + $this->assertSame( '1', $counts[ self::$author_id ] ); + $this->assertSame( '1', $counts[ $user_id_b ] ); $counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', true ); - $this->assertEquals( 1, $counts[ self::$author_id ] ); - $this->assertEquals( 1, $counts[ $user_id_b ] ); + $this->assertSame( '1', $counts[ self::$author_id ] ); + $this->assertSame( '1', $counts[ $user_id_b ] ); wp_set_current_user( $user_id_b ); $counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', false ); - $this->assertEquals( 1, $counts[ self::$author_id ] ); - $this->assertEquals( 2, $counts[ $user_id_b ] ); + $this->assertSame( '1', $counts[ self::$author_id ] ); + $this->assertSame( '2', $counts[ $user_id_b ] ); $counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', true ); - $this->assertEquals( 1, $counts[ self::$author_id ] ); - $this->assertEquals( 1, $counts[ $user_id_b ] ); + $this->assertSame( '1', $counts[ self::$author_id ] ); + $this->assertSame( '1', $counts[ $user_id_b ] ); } /** diff --git a/tests/phpunit/tests/user/countUserPosts.php b/tests/phpunit/tests/user/countUserPosts.php index a4244e2814..dbc94f418e 100644 --- a/tests/phpunit/tests/user/countUserPosts.php +++ b/tests/phpunit/tests/user/countUserPosts.php @@ -59,34 +59,34 @@ class Tests_User_CountUserPosts extends WP_UnitTestCase { } public function test_count_user_posts_post_type_should_default_to_post() { - $this->assertEquals( 4, count_user_posts( self::$user_id ) ); + $this->assertSame( '4', count_user_posts( self::$user_id ) ); } /** * @ticket 21364 */ public function test_count_user_posts_post_type_post() { - $this->assertEquals( 4, count_user_posts( self::$user_id, 'post' ) ); + $this->assertSame( '4', count_user_posts( self::$user_id, 'post' ) ); } /** * @ticket 21364 */ public function test_count_user_posts_post_type_cpt() { - $this->assertEquals( 3, count_user_posts( self::$user_id, 'wptests_pt' ) ); + $this->assertSame( '3', count_user_posts( self::$user_id, 'wptests_pt' ) ); } /** * @ticket 32243 */ public function test_count_user_posts_with_multiple_post_types() { - $this->assertEquals( 7, count_user_posts( self::$user_id, array( 'wptests_pt', 'post' ) ) ); + $this->assertSame( '7', count_user_posts( self::$user_id, array( 'wptests_pt', 'post' ) ) ); } /** * @ticket 32243 */ public function test_count_user_posts_should_ignore_non_existent_post_types() { - $this->assertEquals( 4, count_user_posts( self::$user_id, array( 'foo', 'post' ) ) ); + $this->assertSame( '4', count_user_posts( self::$user_id, array( 'foo', 'post' ) ) ); } } diff --git a/tests/phpunit/tests/user/countUsers.php b/tests/phpunit/tests/user/countUsers.php index 224ddcc8d0..b09cd85784 100644 --- a/tests/phpunit/tests/user/countUsers.php +++ b/tests/phpunit/tests/user/countUsers.php @@ -53,7 +53,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase { $count = count_users( $strategy ); $this->assertSame( 8, $count['total_users'] ); - $this->assertEquals( + $this->assertSameSetsWithIndex( array( 'administrator' => 2, 'editor' => 1, @@ -133,7 +133,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase { $count = count_users( $strategy ); $this->assertSame( 8, $count['total_users'] ); - $this->assertEquals( + $this->assertSameSetsWithIndex( array( 'administrator' => 2, 'editor' => 1, @@ -151,7 +151,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase { restore_current_blog(); $this->assertSame( 2, $count['total_users'] ); - $this->assertEquals( + $this->assertSameSetsWithIndex( array( 'administrator' => 1, 'editor' => 1, @@ -166,7 +166,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase { restore_current_blog(); $this->assertSame( 2, $count['total_users'] ); - $this->assertEquals( + $this->assertSameSetsWithIndex( array( 'administrator' => 1, 'contributor' => 1, @@ -239,7 +239,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase { $count = count_users( $strategy ); $this->assertSame( 3, $count['total_users'] ); - $this->assertEquals( + $this->assertSameSetsWithIndex( array( 'administrator' => 2, 'editor' => 1, diff --git a/tests/phpunit/tests/user/query.php b/tests/phpunit/tests/user/query.php index 3626156c01..788ac77052 100644 --- a/tests/phpunit/tests/user/query.php +++ b/tests/phpunit/tests/user/query.php @@ -52,7 +52,7 @@ class Tests_User_Query extends WP_UnitTestCase { public function test_get_and_set() { $users = new WP_User_Query(); - $this->assertEquals( '', $users->get( 'fields' ) ); + $this->assertNull( $users->get( 'fields' ) ); if ( isset( $users->query_vars['fields'] ) ) { $this->assertSame( '', $users->query_vars['fields'] ); } @@ -582,7 +582,7 @@ class Tests_User_Query extends WP_UnitTestCase { // All values get reset. $query->prepare_query( array( 'fields' => 'all' ) ); $this->assertEmpty( $query->query_limit ); - $this->assertEquals( '', $query->query_limit ); + $this->assertNull( $query->query_limit ); $_query_vars = $query->query_vars; $query->prepare_query(); @@ -1685,7 +1685,7 @@ class Tests_User_Query extends WP_UnitTestCase { $ids = $q->get_results(); // Must include user that has the same string in display_name. - $this->assertEquals( array( $new_user1 ), $ids ); + $this->assertSameSetsWithIndex( array( (string) $new_user1 ), $ids ); } /** diff --git a/tests/phpunit/tests/widgets.php b/tests/phpunit/tests/widgets.php index 527798f7a4..2407a2de1b 100644 --- a/tests/phpunit/tests/widgets.php +++ b/tests/phpunit/tests/widgets.php @@ -1274,10 +1274,10 @@ class Tests_Widgets extends WP_UnitTestCase { $new_next_theme_sidebars = wp_map_sidebars_widgets( $prev_theme_sidebars ); $expected_sidebars = array( - 'primary' => 1, 'wp_inactive_widgets' => array(), + 'primary' => 1, ); - $this->assertEquals( $expected_sidebars, $new_next_theme_sidebars ); + $this->assertSameSetsWithIndex( $expected_sidebars, $new_next_theme_sidebars ); } /** @@ -1295,7 +1295,7 @@ class Tests_Widgets extends WP_UnitTestCase { $new_next_theme_sidebars = wp_map_sidebars_widgets( $prev_theme_sidebars ); - $this->assertEquals( $prev_theme_sidebars, $new_next_theme_sidebars ); + $this->assertSameSetsWithIndex( $prev_theme_sidebars, $new_next_theme_sidebars ); } /** @@ -1318,7 +1318,7 @@ class Tests_Widgets extends WP_UnitTestCase { 'secondary' => array(), 'wp_inactive_widgets' => array(), ); - $this->assertEquals( $expected_sidebars, $new_next_theme_sidebars ); + $this->assertSameSetsWithIndex( $expected_sidebars, $new_next_theme_sidebars ); } /** @@ -1362,6 +1362,6 @@ class Tests_Widgets extends WP_UnitTestCase { 'primary' => array(), 'wp_inactive_widgets' => array(), ); - $this->assertEquals( $expected_sidebars, $new_next_theme_sidebars ); + $this->assertSameSetsWithIndex( $expected_sidebars, $new_next_theme_sidebars ); } } diff --git a/tests/phpunit/tests/widgets/wpWidgetMedia.php b/tests/phpunit/tests/widgets/wpWidgetMedia.php index a61026bec9..b52b5fd413 100644 --- a/tests/phpunit/tests/widgets/wpWidgetMedia.php +++ b/tests/phpunit/tests/widgets/wpWidgetMedia.php @@ -343,7 +343,7 @@ class Tests_Widgets_wpWidgetMedia extends WP_UnitTestCase { $this->widget_instance_filter_args = array(); $widget->widget( $args, $instance ); $this->assertCount( 3, $this->widget_instance_filter_args ); - $this->assertEquals( $instance, $this->widget_instance_filter_args[0] ); + $this->assertSameSetsWithIndex( $instance, $this->widget_instance_filter_args[0] ); $this->assertSame( $args, $this->widget_instance_filter_args[1] ); $this->assertSame( $widget, $this->widget_instance_filter_args[2] ); $output = ob_get_clean(); diff --git a/tests/phpunit/tests/xmlrpc/wp/newPost.php b/tests/phpunit/tests/xmlrpc/wp/newPost.php index a702e7373a..c9b160cf19 100644 --- a/tests/phpunit/tests/xmlrpc/wp/newPost.php +++ b/tests/phpunit/tests/xmlrpc/wp/newPost.php @@ -238,7 +238,7 @@ class Tests_XMLRPC_wp_newPost extends WP_XMLRPC_UnitTestCase { ); $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); $this->assertNotIXRError( $result ); - $this->assertEquals( '', get_post_format( $result ) ); + $this->assertFalse( get_post_format( $result ) ); } public function test_invalid_taxonomy() {