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/query/isTerm.php

    r47122 r48937  
    252252
    253253        // Only compare term_id because object_id may or may not be part of either value.
    254         $this->assertEquals( $expected->term_id, $object->term_id );
     254        $this->assertSame( $expected->term_id, $object->term_id );
    255255    }
    256256
     
    296296
    297297        // Only compare term_id because object_id may or may not be part of either value.
    298         $this->assertEquals( $expected->term_id, $object->term_id );
     298        $this->assertSame( $expected->term_id, $object->term_id );
    299299    }
    300300}
Note: See TracChangeset for help on using the changeset viewer.