Make WordPress Core


Ignore:
Timestamp:
02/10/2021 01:24:24 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in some newly introduced tests.

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

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Follow-up to [49904], [49925], [49992], [50012], [50013], [50065], [50075], [50131], [50150], [50157].

See #38266, #52482.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/nav-menu.php

    r50014 r50284  
    10381038        );
    10391039        $post         = get_post( $menu_item_id );
    1040         $this->assertEquals( get_date_from_gmt( $post_date_gmt ), $post->post_date );
     1040        $this->assertSame( get_date_from_gmt( $post_date_gmt ), $post->post_date );
    10411041
    10421042        $menu_item_id = wp_update_nav_menu_item(
     
    10521052        );
    10531053        $post         = get_post( $menu_item_id );
    1054         $this->assertEquals( '1970-01-01 00:00:00', $post->post_date );
     1054        $this->assertSame( '1970-01-01 00:00:00', $post->post_date );
    10551055
    10561056        $menu_item_id = wp_update_nav_menu_item(
     
    10661066        );
    10671067        $post         = get_post( $menu_item_id );
    1068         $this->assertEquals( $post_date, $post->post_date );
     1068        $this->assertSame( $post_date, $post->post_date );
    10691069
    10701070        $menu_item_id = wp_update_nav_menu_item(
     
    10811081        );
    10821082        $post         = get_post( $menu_item_id );
    1083         $this->assertEquals( $post_date, $post->post_date );
     1083        $this->assertSame( $post_date, $post->post_date );
    10841084
    10851085        $menu_item_id = wp_update_nav_menu_item(
     
    10961096        );
    10971097        $post         = get_post( $menu_item_id );
    1098         $this->assertEquals( $post_date, $post->post_date );
     1098        $this->assertSame( $post_date, $post->post_date );
    10991099
    11001100        $menu_item_id = wp_update_nav_menu_item(
Note: See TracChangeset for help on using the changeset viewer.