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/xmlrpc/client.php

    r46586 r48937  
    1313    function test_ixr_client_allows_query_strings() {
    1414        $client = new IXR_Client( 'http://example.com/server.php?this-is-needed=true#not-this' );
    15         $this->assertEquals( 'example.com', $client->server );
    16         $this->assertEquals( 80, $client->port );
    17         $this->assertEquals( '/server.php?this-is-needed=true', $client->path );
     15        $this->assertSame( 'example.com', $client->server );
     16        $this->assertSame( 80, $client->port );
     17        $this->assertSame( '/server.php?this-is-needed=true', $client->path );
    1818    }
    1919
     
    2323    function test_wp_ixr_client_allows_query_strings() {
    2424        $client = new WP_HTTP_IXR_Client( 'http://example.com/server.php?this-is-needed=true#not-this' );
    25         $this->assertEquals( 'example.com', $client->server );
     25        $this->assertSame( 'example.com', $client->server );
    2626        $this->assertFalse( $client->port );
    27         $this->assertEquals( '/server.php?this-is-needed=true', $client->path );
     27        $this->assertSame( '/server.php?this-is-needed=true', $client->path );
    2828    }
    2929}
Note: See TracChangeset for help on using the changeset viewer.