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/term/getTerm.php

    r46586 r48937  
    7373
    7474    public function test_passing_term_string_that_casts_to_int_0_should_return_null() {
    75         $this->assertSame( null, get_term( 'abc', 'wptests_tax' ) );
     75        $this->assertNull( get_term( 'abc', 'wptests_tax' ) );
    7676    }
    7777
    7878    public function test_should_return_null_for_invalid_term_id() {
    79         $this->assertSame( null, get_term( 99999999, 'wptests_tax' ) );
     79        $this->assertNull( get_term( 99999999, 'wptests_tax' ) );
    8080    }
    8181
Note: See TracChangeset for help on using the changeset viewer.