WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (17 months 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/multisite/siteMeta.php

    r47012 r48937  
    187187            add_site_meta( self::$site_id2, 'unique_delete_by_key', 'value', true );
    188188
    189             $this->assertEquals( 'value', get_site_meta( self::$site_id, 'unique_delete_by_key', true ) );
    190             $this->assertEquals( 'value', get_site_meta( self::$site_id2, 'unique_delete_by_key', true ) );
     189            $this->assertSame( 'value', get_site_meta( self::$site_id, 'unique_delete_by_key', true ) );
     190            $this->assertSame( 'value', get_site_meta( self::$site_id2, 'unique_delete_by_key', true ) );
    191191
    192192            $this->assertTrue( delete_site_meta_by_key( 'unique_delete_by_key' ) );
    193193
    194             $this->assertEquals( '', get_site_meta( self::$site_id, 'unique_delete_by_key', true ) );
    195             $this->assertEquals( '', get_site_meta( self::$site_id2, 'unique_delete_by_key', true ) );
     194            $this->assertSame( '', get_site_meta( self::$site_id, 'unique_delete_by_key', true ) );
     195            $this->assertSame( '', get_site_meta( self::$site_id2, 'unique_delete_by_key', true ) );
    196196        }
    197197
Note: See TracChangeset for help on using the changeset viewer.