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

    r46586 r48937  
    116116
    117117        $term = get_term( $t, 'wptests_tax' );
    118         $this->assertEquals( 0, $term->parent );
     118        $this->assertSame( 0, $term->parent );
    119119        _unregister_taxonomy( 'wptests_tax' );
    120120    }
     
    681681        _unregister_taxonomy( 'wptests_tax' );
    682682
    683         $this->assertSame( false, wp_cache_get( 'all_ids', 'wptests_tax' ) );
    684         $this->assertSame( false, wp_cache_get( 'get', 'wptests_tax' ) );
     683        $this->assertFalse( wp_cache_get( 'all_ids', 'wptests_tax' ) );
     684        $this->assertFalse( wp_cache_get( 'get', 'wptests_tax' ) );
    685685
    686686        $cached_children = get_option( 'wptests_tax_children' );
Note: See TracChangeset for help on using the changeset viewer.