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/ajax/EditComment.php

    r48222 r48937  
    6767
    6868        // Check the meta data.
    69         $this->assertEquals( -1, (string) $xml->response[0]->edit_comment['position'] );
    70         $this->assertEquals( $comment->comment_ID, (string) $xml->response[0]->edit_comment['id'] );
    71         $this->assertEquals( 'edit-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
     69        $this->assertSame( '-1', (string) $xml->response[0]->edit_comment['position'] );
     70        $this->assertSame( $comment->comment_ID, (string) $xml->response[0]->edit_comment['id'] );
     71        $this->assertSame( 'edit-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
    7272
    7373        // Check the payload.
     
    115115
    116116        // Check the meta data.
    117         $this->assertEquals( -1, (string) $xml->response[0]->edit_comment['position'] );
    118         $this->assertEquals( $comment->comment_ID, (string) $xml->response[0]->edit_comment['id'] );
    119         $this->assertEquals( 'edit-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
     117        $this->assertSame( '-1', (string) $xml->response[0]->edit_comment['position'] );
     118        $this->assertSame( $comment->comment_ID, (string) $xml->response[0]->edit_comment['id'] );
     119        $this->assertSame( 'edit-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
    120120
    121121        // Check the payload.
Note: See TracChangeset for help on using the changeset viewer.