Make WordPress Core


Ignore:
Timestamp:
01/06/2024 12:59:49 PM (14 months 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 [55859], [56380], [56802], [57115], [57129], [57185].

See #59655.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ajax/wpAjaxInlineSave.php

    r56802 r57244  
    111111        $this->assertSame( 'draft', $post->post_status );
    112112
    113         $this->assertEquals( '0000-00-00 00:00:00', $post->post_date_gmt );
     113        $this->assertSame( '0000-00-00 00:00:00', $post->post_date_gmt );
    114114
    115115        // Set up a request.
     
    143143        $post_date = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $_POST['aa'], $_POST['mm'], $_POST['jj'], $_POST['hh'], $_POST['mn'], $_POST['ss'] );
    144144
    145         $this->assertEquals( '0000-00-00 00:00:00', $post->post_date_gmt );
     145        $this->assertSame( '0000-00-00 00:00:00', $post->post_date_gmt );
    146146    }
    147147
     
    168168        $this->assertSame( 'draft', $post->post_status );
    169169
    170         $this->assertEquals( '0000-00-00 00:00:00', $post->post_date_gmt );
     170        $this->assertSame( '0000-00-00 00:00:00', $post->post_date_gmt );
    171171
    172172        // Set up a request.
     
    198198        $post = get_post( $post->ID );
    199199
    200         $this->assertEquals( '2020-09-11 19:20:11', $post->post_date_gmt );
     200        $this->assertSame( '2020-09-11 19:20:11', $post->post_date_gmt );
    201201    }
    202202}
Note: See TracChangeset for help on using the changeset viewer.