Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (5 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/wp/getUsers.php

    r47122 r48937  
    1010        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'username', 'password' ) );
    1111        $this->assertIXRError( $results );
    12         $this->assertEquals( 403, $results->code );
     12        $this->assertSame( 403, $results->code );
    1313    }
    1414
     
    1818        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'subscriber', 'subscriber' ) );
    1919        $this->assertIXRError( $results );
    20         $this->assertEquals( 401, $results->code );
     20        $this->assertSame( 401, $results->code );
    2121    }
    2222
     
    5252        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
    5353        $this->assertIXRError( $results );
    54         $this->assertEquals( 403, $results->code );
     54        $this->assertSame( 403, $results->code );
    5555    }
    5656
     
    103103
    104104        // Verify that $user_ids matches $users_found.
    105         $this->assertEquals( 0, count( array_diff( $user_ids, $users_found ) ) );
     105        $this->assertSame( 0, count( array_diff( $user_ids, $users_found ) ) );
    106106    }
    107107
Note: See TracChangeset for help on using the changeset viewer.