Make WordPress Core


Ignore:
Timestamp:
10/07/2022 01:02:07 AM (21 months 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.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
Note: See TracChangeset for help on using the changeset viewer.