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

    r46586 r48937  
    99        $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'username', 'password', 0 ) );
    1010        $this->assertIXRError( $result );
    11         $this->assertEquals( 403, $result->code );
     11        $this->assertSame( 403, $result->code );
    1212    }
    1313
     
    1717        $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', 340982340 ) );
    1818        $this->assertIXRError( $result );
    19         $this->assertEquals( 404, $result->code );
     19        $this->assertSame( 404, $result->code );
    2020    }
    2121
     
    2626        $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) );
    2727        $this->assertIXRError( $result );
    28         $this->assertEquals( 401, $result->code );
     28        $this->assertSame( 401, $result->code );
    2929    }
    3030
     
    3838
    3939        $post = get_post( $post_id );
    40         $this->assertEquals( 'trash', $post->post_status );
     40        $this->assertSame( 'trash', $post->post_status );
    4141    }
    4242}
Note: See TracChangeset for help on using the changeset viewer.