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/bootstrap.php

    r47013 r48937  
    126126        function test_get_network_by_path( $expected_key, $domain, $path, $message ) {
    127127            $network = get_network_by_path( $domain, $path );
    128             $this->assertEquals( self::$network_ids[ $expected_key ], $network->id, $message );
     128            $this->assertSame( self::$network_ids[ $expected_key ], $network->id, $message );
    129129        }
    130130
     
    162162            remove_filter( 'network_by_path_segments_count', '__return_zero' );
    163163
    164             $this->assertEquals( self::$network_ids[ $expected_key ], $network->id, $message );
     164            $this->assertSame( self::$network_ids[ $expected_key ], $network->id, $message );
    165165        }
    166166
     
    187187            remove_filter( 'network_by_path_segments_count', array( $this, 'filter_network_path_segments' ) );
    188188
    189             $this->assertEquals( self::$network_ids['wordpress.org/one/'], $network->id );
     189            $this->assertSame( self::$network_ids['wordpress.org/one/'], $network->id );
    190190        }
    191191
Note: See TracChangeset for help on using the changeset viewer.