Make WordPress Core

Changeset 58054


Ignore:
Timestamp:
04/29/2024 03:38:39 PM (10 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in WP_Comment::get_instance() 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 [38381].

Props costdev.
See #60706.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment/wpComment.php

    r54704 r58054  
    3434        $found = WP_Comment::get_instance( (string) self::$comment_id );
    3535
    36         $this->assertEquals( self::$comment_id, $found->comment_ID );
     36        $this->assertSame( (string) self::$comment_id, $found->comment_ID );
    3737    }
    3838
     
    6161        $found = WP_Comment::get_instance( 1.0 );
    6262
    63         $this->assertEquals( 1, $found->comment_ID );
     63        $this->assertSame( '1', $found->comment_ID );
    6464    }
    6565}
Note: See TracChangeset for help on using the changeset viewer.