Make WordPress Core


Ignore:
Timestamp:
10/07/2022 01:02:07 AM (2 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.