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

    r47122 r48937  
    1010        $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'username', 'password', array() ) );
    1111        $this->assertIXRError( $result );
    12         $this->assertEquals( 403, $result->code );
     12        $this->assertSame( 403, $result->code );
    1313    }
    1414
     
    1818        $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor', array() ) );
    1919        $this->assertIXRError( $result );
    20         $this->assertEquals( 401, $result->code );
     20        $this->assertSame( 401, $result->code );
    2121    }
    2222
     
    3232        foreach ( $results as $result ) {
    3333            $comment = get_comment( $result['comment_id'], ARRAY_A );
    34             $this->assertEquals( $comment['comment_post_ID'], $result['post_id'] );
     34            $this->assertSame( $comment['comment_post_ID'], $result['post_id'] );
    3535        }
    3636    }
     
    135135        $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor' ) );
    136136        $this->assertIXRError( $result );
    137         $this->assertEquals( 401, $result->code );
     137        $this->assertSame( 401, $result->code );
    138138    }
    139139
Note: See TracChangeset for help on using the changeset viewer.