Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: First pass at using assertSame() instead of assertEquals() in most of the unit 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.

Props johnbillion, jrf, SergeyBiryukov.
See #38266.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/updateUserCaches.php

    r46586 r48937  
    2525        update_user_caches( $data );
    2626
    27         $this->assertEquals( 12345, wp_cache_get( 'foo', 'userlogins' ) );
     27        $this->assertSame( 12345, wp_cache_get( 'foo', 'userlogins' ) );
    2828    }
    2929
     
    3737        update_user_caches( $data );
    3838
    39         $this->assertEquals( 12345, wp_cache_get( 'foo@example.com', 'useremail' ) );
     39        $this->assertSame( 12345, wp_cache_get( 'foo@example.com', 'useremail' ) );
    4040    }
    4141
     
    4949        update_user_caches( $data );
    5050
    51         $this->assertEquals( 12345, wp_cache_get( 'bar', 'userslugs' ) );
     51        $this->assertSame( 12345, wp_cache_get( 'bar', 'userslugs' ) );
    5252    }
    5353
Note: See TracChangeset for help on using the changeset viewer.