Make WordPress Core

Changeset 54402


Ignore:
Timestamp:
10/07/2022 01:02:07 AM (4 years ago)
Author:
desrosj
Message:

Tests: Replace some occurrences of assertEquals() with assertSame().

This ensures that not only the return values match the expected results, but also that their type is the same.

Props costdev, desrosj.
See #55654.

Location:
trunk/tests/phpunit/tests
Files:
40 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/includesUser.php

    r49109 r54402  
    1818                if ( $error_code ) {
    1919                        $this->assertWPError( $error );
    20                         $this->assertEquals( $error_code, $error->get_error_code() );
     20                        $this->assertSame( $error_code, $error->get_error_code() );
    2121                } else {
    2222                        $this->assertNotWPError( $error );
  • trunk/tests/phpunit/tests/ajax/CustomizeManager.php

    r54088 r54402  
    133133                }
    134134                $this->assertNotEmpty( $e );
    135                 $this->assertEquals( -1, $e->getMessage() );
     135                $this->assertSame( '-1', $e->getMessage() );
    136136
    137137                // Not called setup_theme.
  • trunk/tests/phpunit/tests/block-template-utils.php

    r54198 r54402  
    209209         */
    210210        function test_remove_theme_attribute_in_block_template_content( $template_content, $expected ) {
    211                 $this->assertEquals( $expected, _remove_theme_attribute_in_block_template_content( $template_content ) );
     211                $this->assertSame( $expected, _remove_theme_attribute_in_block_template_content( $template_content ) );
    212212        }
    213213
  • trunk/tests/phpunit/tests/blocks/wpBlockType.php

    r53268 r54402  
    241241                $prepared_attributes = $block_type->prepare_attributes_for_render( $attributes );
    242242
    243                 $this->assertEquals(
     243                $this->assertSameSetsWithIndex(
    244244                        array(
    245245                                'correct'            => 'include',
  • trunk/tests/phpunit/tests/comment/getCommentsPagesCount.php

    r53863 r54402  
    175175                $wp_query->max_num_comment_pages = 7;
    176176
    177                 $this->assertEquals( 7, get_comment_pages_count() );
    178                 $this->assertEquals( 7, get_comment_pages_count( null, null, null ) );
    179                 $this->assertEquals( 0, get_comment_pages_count( array(), null, null ) );
     177                $this->assertSame( 7, get_comment_pages_count() );
     178                $this->assertSame( 7, get_comment_pages_count( null, null, null ) );
     179                $this->assertSame( 0, get_comment_pages_count( array(), null, null ) );
    180180
    181181                $wp_query->max_num_comment_pages = $org_max_num_comment_pages;
  • trunk/tests/phpunit/tests/comment/query.php

    r53942 r54402  
    40224022                );
    40234023
    4024                 $this->assertEquals( 3, $q->found_comments );
     4024                $this->assertSame( 3, $q->found_comments );
    40254025                $this->assertEquals( 2, $q->max_num_pages );
    40264026        }
  • trunk/tests/phpunit/tests/customize/manager.php

    r54088 r54402  
    25342534                $this->assertSame( $default_value, $setting->post_value( $default_value ) );
    25352535
    2536                 $post_value = '42';
    2537                 $this->manager->set_post_value( 'numeric', $post_value );
    2538                 $this->assertEquals( $post_value, $this->manager->post_value( $setting, $default_value ) );
    2539                 $this->assertEquals( $post_value, $setting->post_value( $default_value ) );
     2536                $post_value = 42;
     2537                $this->manager->set_post_value( 'numeric', (string) $post_value );
     2538                $this->assertSame( $post_value, $this->manager->post_value( $setting, $default_value ) );
     2539                $this->assertSame( $post_value, $setting->post_value( $default_value ) );
    25402540        }
    25412541
  • trunk/tests/phpunit/tests/customize/selective-refresh-ajax.php

    r52010 r54402  
    189189                );
    190190
    191                 $count_customize_render_partials_before = has_action( 'customize_render_partials_before' );
    192                 $count_customize_render_partials_after  = has_action( 'customize_render_partials_after' );
    193191                ob_start();
    194192                try {
    … …  
    201199                        $this->assertSame( '', $e->getMessage() );
    202200                }
    203                 $this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) );
    204                 $this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) );
     201                $this->assertTrue( has_action( 'customize_render_partials_before' ) );
     202                $this->assertTrue( has_action( 'customize_render_partials_after' ) );
    205203                $output = json_decode( ob_get_clean(), true );
    206204                $this->assertSame( array( false ), $output['data']['contents']['foo'] );
    … …  
    327325                );
    328326
    329                 $count_customize_render_partials_before = has_action( 'customize_render_partials_before' );
    330                 $count_customize_render_partials_after  = has_action( 'customize_render_partials_after' );
    331327                ob_start();
    332328                try {
    … …  
    339335                        $this->assertSame( '', $e->getMessage() );
    340336                }
    341                 $this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) );
    342                 $this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) );
     337                $this->assertTrue( has_action( 'customize_render_partials_before' ) );
     338                $this->assertTrue( has_action( 'customize_render_partials_after' ) );
    343339                $output = json_decode( ob_get_clean(), true );
    344340                $this->assertSame( array( get_bloginfo( 'name', 'display' ) ), $output['data']['contents']['test_blogname'] );
    … …  
    436432                );
    437433
    438                 $count_customize_render_partials_before = has_action( 'customize_render_partials_before' );
    439                 $count_customize_render_partials_after  = has_action( 'customize_render_partials_after' );
    440434                ob_start();
    441435                try {
    … …  
    448442                        $this->assertSame( '', $e->getMessage() );
    449443                }
    450                 $this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) );
    451                 $this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) );
     444                $this->assertTrue( has_action( 'customize_render_partials_before' ) );
     445                $this->assertTrue( has_action( 'customize_render_partials_after' ) );
    452446                $output = json_decode( ob_get_clean(), true );
    453447                $this->assertSame( array( get_bloginfo( 'name', 'display' ) ), $output['data']['contents']['test_dynamic_blogname'] );
    … …  
    488482                );
    489483
    490                 $count_customize_render_partials_before = has_action( 'customize_render_partials_before' );
    491                 $count_customize_render_partials_after  = has_action( 'customize_render_partials_after' );
    492484                ob_start();
    493485                try {
    … …  
    500492                        $this->assertSame( '', $e->getMessage() );
    501493                }
    502                 $this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) );
    503                 $this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) );
     494                $this->assertTrue( has_action( 'customize_render_partials_before' ) );
     495                $this->assertTrue( has_action( 'customize_render_partials_after' ) );
    504496                $output = json_decode( ob_get_clean(), true );
    505497                $this->assertSame( array( get_bloginfo( 'name', 'display' ) ), $output['data']['contents']['test_blogname'] );
  • trunk/tests/phpunit/tests/formatting/mapDeep.php

    r53562 r54402  
    5050
    5151        public function test_map_deep_should_map_each_object_element_of_an_array() {
    52                 $this->assertEquals(
     52                $this->assertEqualSets(
    5353                        array(
    5454                                'var0' => 'ababa',
  • trunk/tests/phpunit/tests/functions.php

    r53934 r54402  
    20572057         */
    20582058        public function test_wp_get_default_extension_for_mime_type() {
    2059                 $this->assertEquals( 'jpg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpg not returned as default extension for "image/jpeg"' );
     2059                $this->assertSame( 'jpg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpg not returned as default extension for "image/jpeg"' );
    20602060                $this->assertNotEquals( 'jpeg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpeg should not be returned as default extension for "image/jpeg"' );
    2061                 $this->assertEquals( 'png', wp_get_default_extension_for_mime_type( 'image/png' ), 'png not returned as default extension for "image/png"' );
     2061                $this->assertSame( 'png', wp_get_default_extension_for_mime_type( 'image/png' ), 'png not returned as default extension for "image/png"' );
    20622062                $this->assertFalse( wp_get_default_extension_for_mime_type( 'wibble/wobble' ), 'false not returned for unrecognized mime type' );
    20632063                $this->assertFalse( wp_get_default_extension_for_mime_type( '' ), 'false not returned when empty string as mime type supplied' );
    … …  
    20732073        function test_wp_filesize_with_nonexistent_file() {
    20742074                $file = 'nonexistent/file.jpg';
    2075                 $this->assertEquals( 0, wp_filesize( $file ) );
     2075                $this->assertSame( 0, wp_filesize( $file ) );
    20762076        }
    20772077
    … …  
    20832083                $file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';
    20842084
    2085                 $this->assertEquals( filesize( $file ), wp_filesize( $file ) );
     2085                $this->assertSame( filesize( $file ), wp_filesize( $file ) );
    20862086
    20872087                $filter = function() {
    … …  
    20912091                add_filter( 'wp_filesize', $filter );
    20922092
    2093                 $this->assertEquals( 999, wp_filesize( $file ) );
     2093                $this->assertSame( 999, wp_filesize( $file ) );
    20942094
    20952095                $pre_filter = function() {
    … …  
    20992099                add_filter( 'pre_wp_filesize', $pre_filter );
    21002100
    2101                 $this->assertEquals( 111, wp_filesize( $file ) );
     2101                $this->assertSame( 111, wp_filesize( $file ) );
    21022102        }
    21032103
    … …  
    21852185                        'version'  => 1,
    21862186                );
    2187                 $this->assertEquals( $theme_json, $expected_theme_json );
     2187                $this->assertSameSetsWithIndex( $theme_json, $expected_theme_json );
    21882188        }
    21892189
  • trunk/tests/phpunit/tests/import/import.php

    r53864 r54402  
    6363
    6464                // Check that terms were imported correctly.
    65                 $this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
    66                 $this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
     65                $this->assertSame( '30', wp_count_terms( array( 'taxonomy' => 'category' ) ) );
     66                $this->assertSame( '3', wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
    6767                $foo = get_term_by( 'slug', 'foo', 'category' );
    6868                $this->assertSame( 0, $foo->parent );
    … …  
    7373                // Check that posts/pages were imported correctly.
    7474                $post_count = wp_count_posts( 'post' );
    75                 $this->assertEquals( 5, $post_count->publish );
    76                 $this->assertEquals( 1, $post_count->private );
     75                $this->assertSame( '5', $post_count->publish );
     76                $this->assertSame( '1', $post_count->private );
    7777                $page_count = wp_count_posts( 'page' );
    78                 $this->assertEquals( 4, $page_count->publish );
    79                 $this->assertEquals( 1, $page_count->draft );
     78                $this->assertSame( '4', $page_count->publish );
     79                $this->assertSame( '1', $page_count->draft );
    8080                $comment_count = wp_count_comments();
    8181                $this->assertSame( 1, $comment_count->total_comments );
    … …  
    231231                $this->assertSame( 'author@example.org', $author->user_email );
    232232
    233                 $this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
    234                 $this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
     233                $this->assertSame( '30', wp_count_terms( array( 'taxonomy' => 'category' ) ) );
     234                $this->assertSame( '3', wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
    235235                $foo = get_term_by( 'slug', 'foo', 'category' );
    236236                $this->assertSame( 0, $foo->parent );
    … …  
    240240
    241241                $post_count = wp_count_posts( 'post' );
    242                 $this->assertEquals( 5, $post_count->publish );
    243                 $this->assertEquals( 1, $post_count->private );
     242                $this->assertSame( '5', $post_count->publish );
     243                $this->assertSame( '1', $post_count->private );
    244244                $page_count = wp_count_posts( 'page' );
    245                 $this->assertEquals( 4, $page_count->publish );
    246                 $this->assertEquals( 1, $page_count->draft );
     245                $this->assertSame( '4', $page_count->publish );
     246                $this->assertSame( '1', $page_count->draft );
    247247                $comment_count = wp_count_comments();
    248248                $this->assertSame( 1, $comment_count->total_comments );
  • trunk/tests/phpunit/tests/import/parser.php

    r53864 r54402  
    7575                        $this->assertIsArray( $result, $message );
    7676                        $this->assertSame( 'http://localhost/', $result['base_url'], $message );
    77                         $this->assertEquals(
     77                        $this->assertEqualSetsWithIndex(
    7878                                array(
    7979                                        'author_id'           => 2,
    … …  
    8787                                $message
    8888                        );
    89                         $this->assertEquals(
     89                        $this->assertEqualSetsWithIndex(
    9090                                array(
    9191                                        'term_id'              => 3,
    … …  
    9898                                $message
    9999                        );
    100                         $this->assertEquals(
     100                        $this->assertEqualSetsWithIndex(
    101101                                array(
    102102                                        'term_id'         => 22,
    … …  
    108108                                $message
    109109                        );
    110                         $this->assertEquals(
     110                        $this->assertEqualSetsWithIndex(
    111111                                array(
    112112                                        'term_id'          => 40,
    … …  
    124124                        $this->assertCount( 19, $result['posts'][0], $message );
    125125                        $this->assertCount( 18, $result['posts'][1], $message );
    126                         $this->assertEquals(
     126                        $this->assertEqualSetsWithIndex(
    127127                                array(
    128128                                        array(
  • trunk/tests/phpunit/tests/import/postmeta.php

    r53864 r54402  
    7777                $expected[]  = $classy;
    7878
    79                 $this->assertEquals( $expected, get_post_meta( 150, 'test', true ) );
     79                $this->assertEqualSets( $expected, get_post_meta( 150, 'test', true ) );
    8080        }
    8181
  • trunk/tests/phpunit/tests/media.php

    r54226 r54402  
    502502
    503503                $images = get_attached_media( 'image', $post_id );
    504                 $this->assertEquals( $images, array( $attachment_id => get_post( $attachment_id ) ) );
     504                $this->assertEqualSets( $images, array( $attachment_id => get_post( $attachment_id ) ) );
    505505        }
    506506
  • trunk/tests/phpunit/tests/multisite/network.php

    r54088 r54402  
    172172                        wp_update_network_counts();
    173173
    174                         $this->assertEquals( $site_count_start, $actual );
     174                        $this->assertSame( $site_count_start, $actual );
    175175                }
    176176
    … …  
    192192                        wp_update_network_counts();
    193193
    194                         $this->assertEquals( $site_count_start + 1, $actual );
     194                        $this->assertSame( $site_count_start + 1, $actual );
    195195                }
    196196
    … …  
    203203                        $site_count = get_blog_count( self::$different_network_id );
    204204
    205                         $this->assertEquals( count( self::$different_site_ids ), $site_count );
    206                 }
    207 
    208 
     205                        $this->assertSame( count( self::$different_site_ids ), $site_count );
     206                }
    209207
    210208                public function test_active_network_plugins() {
  • trunk/tests/phpunit/tests/multisite/site.php

    r54088 r54402  
    15561556                        $site3  = get_site( $site_id );
    15571557
    1558                         $this->assertEquals( 1, $site1->public );
    1559                         $this->assertEquals( 0, $site2->public );
    1560                         $this->assertEquals( 1, $site3->public );
     1558                        $this->assertSame( '1', $site1->public );
     1559                        $this->assertSame( '0', $site2->public );
     1560                        $this->assertSame( '1', $site3->public );
    15611561                }
    15621562
    … …  
    24342434                        wpmu_create_blog( 'testsite1.example.org', '/new-blog/', 'New Blog', get_current_user_id(), $meta, 1 );
    24352435
    2436                         $this->assertEquals( $expected_meta, $this->wp_initialize_site_meta );
     2436                        $this->assertSameSetsWithIndex( $expected_meta, $this->wp_initialize_site_meta );
    24372437
    24382438                        $this->wp_initialize_site_meta = array();
    … …  
    25352535                                        array(
    25362536                                                'public' => 0,
     2537                                                'foo'    => 'bar',
    25372538                                                'WPLANG' => 'en_US',
    2538                                                 'foo'    => 'bar',
    25392539                                        ),
    25402540                                ),
  • trunk/tests/phpunit/tests/option/networkOption.php

    r54080 r54402  
    177177
    178178                // Check they exists.
    179                 $this->assertEquals( $funky_meta, get_network_option( $network_id, $option ) );
     179                $this->assertEqualSets( $funky_meta, get_network_option( $network_id, $option ) );
    180180        }
    181181
    … …  
    191191                add_metadata( 'site', $network_id, $option, 'tuesday', true );
    192192                add_metadata( 'site', $network_id, $option, 'wednesday', true );
    193                 $this->assertEquals( 'monday', get_network_option( $network_id, $option, true ) );
     193                $this->assertSame( 'monday', get_network_option( $network_id, $option, true ) );
    194194        }
    195195
    … …  
    280280
    281281                add_metadata( 'site', $network_id, $option, $array_w_object, true );
    282                 $this->assertEquals( $array_w_object, get_network_option( $network_id, $option ) );
     282                $this->assertEqualSets( $array_w_object, get_network_option( $network_id, $option ) );
    283283        }
    284284
  • trunk/tests/phpunit/tests/post/getPages.php

    r52010 r54402  
    425425                );
    426426                // Confirm the defaults.
    427                 $this->assertEquals( $pages, $pages_default_args );
     427                $this->assertEqualSets( $pages, $pages_default_args );
    428428
    429429                /*
    … …  
    469469                );
    470470
    471                 $this->assertEquals( $pages, $default_args );
     471                $this->assertEqualSets( $pages, $default_args );
    472472
    473473                /*
  • trunk/tests/phpunit/tests/post/meta.php

    r52389 r54402  
    249249
    250250                // Check it exists.
    251                 $this->assertEquals( $funky_meta, get_post_meta( self::$post_id, 'test_funky_post_meta', true ) );
     251                $this->assertEqualSets( $funky_meta, get_post_meta( self::$post_id, 'test_funky_post_meta', true ) );
    252252
    253253        }
  • trunk/tests/phpunit/tests/post/wpInsertPost.php

    r54088 r54402  
    901901                $assigned_terms = wp_get_object_terms( array( $post_id ), array( 'category' ), array() );
    902902                $this->assertCount( 1, $assigned_terms );
    903                 $this->assertEquals( $term_id, $assigned_terms[0]->term_id );
     903                $this->assertSame( $term_id, $assigned_terms[0]->term_id );
    904904
    905905                // Update the post with no changes.
    … …  
    910910                $assigned_terms = wp_get_object_terms( array( $post_id ), array( 'category' ), array() );
    911911                $this->assertCount( 1, $assigned_terms );
    912                 $this->assertEquals( $term_id, $assigned_terms[0]->term_id );
     912                $this->assertSame( $term_id, $assigned_terms[0]->term_id );
    913913
    914914                // Remove the term from the post.
  • trunk/tests/phpunit/tests/query/date.php

    r51568 r54402  
    299299                );
    300300
    301                 $this->assertEquals( $expected, $posts );
     301                $this->assertEqualSets( $expected, $posts );
    302302        }
    303303
  • trunk/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php

    r54058 r54402  
    422422
    423423                $this->assertSame( $expected_attributes, json_decode( $data['rendered'], true ) );
    424                 $this->assertEquals(
     424                $this->assertEqualSetsWithIndex(
    425425                        json_decode( $block_type->render( $attributes ), true ),
    426426                        json_decode( $data['rendered'], true )
  • trunk/tests/phpunit/tests/rest-api/rest-global-styles-controller.php

    r54058 r54402  
    372372                $links    = $response->get_links();
    373373
    374                 $this->assertEquals(
     374                $this->assertEqualSets(
    375375                        array(
    376376                                'id'       => self::$global_styles_id,
    … …  
    410410                $response = rest_get_server()->dispatch( $request );
    411411                $data     = $response->get_data();
    412                 $this->assertEquals( 'My new global styles title', $data['title']['raw'] );
     412                $this->assertSame( 'My new global styles title', $data['title']['raw'] );
    413413        }
    414414
  • trunk/tests/phpunit/tests/rest-api/rest-post-meta-fields.php

    r54090 r54402  
    27982798
    27992799                $this->assertSame( 200, $response->get_status() );
    2800                 $this->assertEquals( array( 0 ), $response->get_data()['meta']['multi_boolean'] );
     2800                $this->assertSameSetsWithIndex( array( false ), $response->get_data()['meta']['multi_boolean'] );
    28012801
    28022802                $this->assertFalse( get_metadata_by_mid( 'post', $mid1 ) );
  • trunk/tests/phpunit/tests/rest-api/rest-site-health-controller.php

    r54043 r54402  
    117117
    118118                $route = current( $route );
    119                 $this->assertEquals(
     119                $this->assertSame(
    120120                        array( WP_REST_Server::READABLE => true ),
    121121                        $route['methods']
    122122                );
    123123
    124                 $this->assertEquals(
     124                $this->assertSame(
    125125                        'test_page_cache',
    126126                        $route['callback'][1]
  • trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php

    r54176 r54402  
    629629                $this->assertArrayHasKey( 'theme_supports', $result[0] );
    630630                $this->assertArrayHasKey( 'editor-font-sizes', $result[0]['theme_supports'] );
    631                 $this->assertEquals( array( $tiny ), $result[0]['theme_supports']['editor-font-sizes'] );
     631                $this->assertEqualSetsWithIndex( array( $tiny ), $result[0]['theme_supports']['editor-font-sizes'] );
    632632        }
    633633
  • trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php

    r54269 r54402  
    344344        public function test_sanitize_template_id( $input_id, $sanitized_id ) {
    345345                $endpoint = new WP_REST_Templates_Controller( 'wp_template' );
    346                 $this->assertEquals(
     346                $this->assertSame(
    347347                        $sanitized_id,
    348348                        $endpoint->_sanitize_template_id( $input_id )
  • trunk/tests/phpunit/tests/style-engine/wpStyleEngineCssRulesStore.php

    r54156 r54402  
    8989                $quesadilla_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'quesadilla' );
    9090
    91                 $this->assertEquals(
     91                $this->assertSame(
    9292                        array(
    9393                                'burrito'    => $burrito_store,
    … …  
    109109                $tzatziki_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'tzatziki' );
    110110
    111                 $this->assertEquals(
     111                $this->assertSame(
    112112                        array(
    113113                                'dolmades' => $dolmades_store,
    … …  
    120120                WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
    121121
    122                 $this->assertEquals(
     122                $this->assertSame(
    123123                        array(),
    124124                        WP_Style_Engine_CSS_Rules_Store::get_stores(),
  • trunk/tests/phpunit/tests/term.php

    r54091 r54402  
    7676                );
    7777                // There are 5 posts, all Uncategorized.
    78                 $this->assertEquals( 1, $count );
     78                $this->assertSame( '1', $count );
    7979        }
    8080
    … …  
    8787                // Counts all terms (1 default category, 5 tags).
    8888                $count = wp_count_terms();
    89                 $this->assertEquals( 6, $count );
     89                $this->assertSame( '6', $count );
    9090
    9191                // Counts only tags (5), with both current and legacy signature.
    … …  
    9393                $count        = wp_count_terms( array( 'taxonomy' => 'post_tag' ) );
    9494                $legacy_count = wp_count_terms( 'post_tag' );
    95                 $this->assertEquals( 5, $count );
    96                 $this->assertEquals( $count, $legacy_count );
     95                $this->assertSame( '5', $count );
     96                $this->assertSame( $count, $legacy_count );
    9797        }
    9898
    … …  
    160160                $this->assertNotWPError( $t );
    161161                $this->assertGreaterThan( 0, $t );
    162                 $this->assertEquals( $initial_count + 1, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
     162                $this->assertSame( (string) ( $initial_count + 1 ), wp_count_terms( array( 'taxonomy' => 'category' ) ) );
    163163
    164164                // Make sure the term exists.
    … …  
    170170                $this->assertNull( term_exists( $term ) );
    171171                $this->assertNull( term_exists( $t ) );
    172                 $this->assertEquals( $initial_count, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
     172                $this->assertSame( $initial_count, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
    173173        }
    174174
  • trunk/tests/phpunit/tests/term/getTerms.php

    r53496 r54402  
    256256                        )
    257257                );
    258                 $this->assertEquals(
     258                $this->assertSameSetsWithIndex(
    259259                        array(
    260260                                $term_id1 => 0,
    … …  
    289289                        )
    290290                );
    291                 $this->assertEquals(
     291                $this->assertSameSetsWithIndex(
    292292                        array(
    293293                                $term_id1 => 'WOO!',
    … …  
    304304                        )
    305305                );
    306                 $this->assertEquals(
     306                $this->assertSameSetsWithIndex(
    307307                        array(
    308308                                $term_id1 => 'woo',
  • trunk/tests/phpunit/tests/term/taxQuery.php

    r51568 r54402  
    6060                );
    6161
    62                 $this->assertEquals( $expected, $tq->queries[0] );
     62                $this->assertSameSetsWithIndex( $expected, $tq->queries[0] );
    6363        }
    6464
    … …  
    8383                );
    8484
    85                 $this->assertEquals( $expected, $tq->queries[0] );
     85                $this->assertSameSetsWithIndex( $expected, $tq->queries[0] );
    8686        }
    8787
    … …  
    263263                $tq->transform_query( $tq->queries[0], 'term_taxonomy_id' );
    264264
    265                 $this->assertEquals( $tt_ids, $tq->queries[0]['terms'] );
     265                $this->assertEqualSets( $tt_ids, $tq->queries[0]['terms'] );
    266266                $this->assertSame( 'term_taxonomy_id', $tq->queries[0]['field'] );
    267267        }
  • trunk/tests/phpunit/tests/theme/wpThemeJson.php

    r54362 r54402  
    677677                        $theme_json->get_stylesheet( array( 'presets' ) )
    678678                );
     679
    679680                $this->assertSame(
    680681                        '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;}',
    … …  
    33533354                );
    33543355
    3355                 $this->assertEquals(
     3356                $this->assertSame(
    33563357                        '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;}',
    33573358                        $theme_json->get_stylesheet()
  • trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php

    r54186 r54402  
    367367                }
    368368                $query_count = count( $this->queries ) - $query_count;
    369                 $this->assertEquals( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
     369                $this->assertSame( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
    370370
    371371                $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
    … …  
    382382                }
    383383                $query_count = count( $this->queries ) - $query_count;
    384                 $this->assertEquals( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
     384                $this->assertSame( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
    385385                remove_filter( 'query', array( $this, 'filter_db_query' ) );
    386386        }
  • trunk/tests/phpunit/tests/user.php

    r54088 r54402  
    561561                wp_set_current_user( self::$author_id );
    562562                $counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', false );
    563                 $this->assertEquals( 1, $counts[ self::$author_id ] );
    564                 $this->assertEquals( 1, $counts[ $user_id_b ] );
     563                $this->assertSame( '1', $counts[ self::$author_id ] );
     564                $this->assertSame( '1', $counts[ $user_id_b ] );
    565565
    566566                $counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', true );
    567                 $this->assertEquals( 1, $counts[ self::$author_id ] );
    568                 $this->assertEquals( 1, $counts[ $user_id_b ] );
     567                $this->assertSame( '1', $counts[ self::$author_id ] );
     568                $this->assertSame( '1', $counts[ $user_id_b ] );
    569569
    570570                wp_set_current_user( $user_id_b );
    571571                $counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', false );
    572                 $this->assertEquals( 1, $counts[ self::$author_id ] );
    573                 $this->assertEquals( 2, $counts[ $user_id_b ] );
     572                $this->assertSame( '1', $counts[ self::$author_id ] );
     573                $this->assertSame( '2', $counts[ $user_id_b ] );
    574574
    575575                $counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', true );
    576                 $this->assertEquals( 1, $counts[ self::$author_id ] );
    577                 $this->assertEquals( 1, $counts[ $user_id_b ] );
     576                $this->assertSame( '1', $counts[ self::$author_id ] );
     577                $this->assertSame( '1', $counts[ $user_id_b ] );
    578578        }
    579579
  • trunk/tests/phpunit/tests/user/countUserPosts.php

    r51568 r54402  
    6060
    6161        public function test_count_user_posts_post_type_should_default_to_post() {
    62                 $this->assertEquals( 4, count_user_posts( self::$user_id ) );
     62                $this->assertSame( '4', count_user_posts( self::$user_id ) );
    6363        }
    6464
    … …  
    6767         */
    6868        public function test_count_user_posts_post_type_post() {
    69                 $this->assertEquals( 4, count_user_posts( self::$user_id, 'post' ) );
     69                $this->assertSame( '4', count_user_posts( self::$user_id, 'post' ) );
    7070        }
    7171
    … …  
    7474         */
    7575        public function test_count_user_posts_post_type_cpt() {
    76                 $this->assertEquals( 3, count_user_posts( self::$user_id, 'wptests_pt' ) );
     76                $this->assertSame( '3', count_user_posts( self::$user_id, 'wptests_pt' ) );
    7777        }
    7878
    … …  
    8181         */
    8282        public function test_count_user_posts_with_multiple_post_types() {
    83                 $this->assertEquals( 7, count_user_posts( self::$user_id, array( 'wptests_pt', 'post' ) ) );
     83                $this->assertSame( '7', count_user_posts( self::$user_id, array( 'wptests_pt', 'post' ) ) );
    8484        }
    8585
    … …  
    8888         */
    8989        public function test_count_user_posts_should_ignore_non_existent_post_types() {
    90                 $this->assertEquals( 4, count_user_posts( self::$user_id, array( 'foo', 'post' ) ) );
     90                $this->assertSame( '4', count_user_posts( self::$user_id, array( 'foo', 'post' ) ) );
    9191        }
    9292}
  • trunk/tests/phpunit/tests/user/countUsers.php

    r52010 r54402  
    5454
    5555                $this->assertSame( 8, $count['total_users'] );
    56                 $this->assertEquals(
     56                $this->assertSameSetsWithIndex(
    5757                        array(
    5858                                'administrator' => 2,
    … …  
    134134
    135135                $this->assertSame( 8, $count['total_users'] );
    136                 $this->assertEquals(
     136                $this->assertSameSetsWithIndex(
    137137                        array(
    138138                                'administrator' => 2,
    … …  
    152152
    153153                $this->assertSame( 2, $count['total_users'] );
    154                 $this->assertEquals(
     154                $this->assertSameSetsWithIndex(
    155155                        array(
    156156                                'administrator' => 1,
    … …  
    167167
    168168                $this->assertSame( 2, $count['total_users'] );
    169                 $this->assertEquals(
     169                $this->assertSameSetsWithIndex(
    170170                        array(
    171171                                'administrator' => 1,
    … …  
    240240
    241241                $this->assertSame( 3, $count['total_users'] );
    242                 $this->assertEquals(
     242                $this->assertSameSetsWithIndex(
    243243                        array(
    244244                                'administrator' => 2,
  • trunk/tests/phpunit/tests/user/query.php

    r54090 r54402  
    5353                $users = new WP_User_Query();
    5454
    55                 $this->assertEquals( '', $users->get( 'fields' ) );
     55                $this->assertNull( $users->get( 'fields' ) );
    5656                if ( isset( $users->query_vars['fields'] ) ) {
    5757                        $this->assertSame( '', $users->query_vars['fields'] );
    … …  
    583583                $query->prepare_query( array( 'fields' => 'all' ) );
    584584                $this->assertEmpty( $query->query_limit );
    585                 $this->assertEquals( '', $query->query_limit );
     585                $this->assertNull( $query->query_limit );
    586586                $_query_vars = $query->query_vars;
    587587
    … …  
    16861686
    16871687                // Must include user that has the same string in display_name.
    1688                 $this->assertEquals( array( $new_user1 ), $ids );
     1688                $this->assertSameSetsWithIndex( array( (string) $new_user1 ), $ids );
    16891689        }
    16901690
  • trunk/tests/phpunit/tests/widgets.php

    r54112 r54402  
    12751275
    12761276                $expected_sidebars = array(
     1277                        'wp_inactive_widgets' => array(),
    12771278                        'primary'             => 1,
    1278                         'wp_inactive_widgets' => array(),
    1279                 );
    1280                 $this->assertEquals( $expected_sidebars, $new_next_theme_sidebars );
     1279                );
     1280                $this->assertSameSetsWithIndex( $expected_sidebars, $new_next_theme_sidebars );
    12811281        }
    12821282
    … …  
    12961296                $new_next_theme_sidebars = wp_map_sidebars_widgets( $prev_theme_sidebars );
    12971297
    1298                 $this->assertEquals( $prev_theme_sidebars, $new_next_theme_sidebars );
     1298                $this->assertSameSetsWithIndex( $prev_theme_sidebars, $new_next_theme_sidebars );
    12991299        }
    13001300
    … …  
    13191319                        'wp_inactive_widgets' => array(),
    13201320                );
    1321                 $this->assertEquals( $expected_sidebars, $new_next_theme_sidebars );
     1321                $this->assertSameSetsWithIndex( $expected_sidebars, $new_next_theme_sidebars );
    13221322        }
    13231323
    … …  
    13631363                        'wp_inactive_widgets' => array(),
    13641364                );
    1365                 $this->assertEquals( $expected_sidebars, $new_next_theme_sidebars );
     1365                $this->assertSameSetsWithIndex( $expected_sidebars, $new_next_theme_sidebars );
    13661366        }
    13671367}
  • trunk/tests/phpunit/tests/widgets/wpWidgetMedia.php

    r54088 r54402  
    344344                $widget->widget( $args, $instance );
    345345                $this->assertCount( 3, $this->widget_instance_filter_args );
    346                 $this->assertEquals( $instance, $this->widget_instance_filter_args[0] );
     346                $this->assertSameSetsWithIndex( $instance, $this->widget_instance_filter_args[0] );
    347347                $this->assertSame( $args, $this->widget_instance_filter_args[1] );
    348348                $this->assertSame( $widget, $this->widget_instance_filter_args[2] );
  • trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php

    r52010 r54402  
    239239                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    240240                $this->assertNotIXRError( $result );
    241                 $this->assertEquals( '', get_post_format( $result ) );
     241                $this->assertFalse( get_post_format( $result ) );
    242242        }
    243243
Note: See TracChangeset for help on using the changeset viewer.