WordPress.org

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

    r48220 r48937  
    6464
    6565        // Check the meta data.
    66         $this->assertEquals( 1, (string) $xml->response[0]->comments['position'] );
    67         $this->assertEquals( 0, (string) $xml->response[0]->comments['id'] );
    68         $this->assertEquals( 'get-comments_0', (string) $xml->response['action'] );
     66        $this->assertSame( '1', (string) $xml->response[0]->comments['position'] );
     67        $this->assertSame( '0', (string) $xml->response[0]->comments['id'] );
     68        $this->assertSame( 'get-comments_0', (string) $xml->response['action'] );
    6969
    7070        // Check the payload.
Note: See TracChangeset for help on using the changeset viewer.