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/Attachments.php

    r47198 r48937  
    5959        // Ensure everything is correct.
    6060        $this->assertTrue( $response['success'] );
    61         $this->assertEquals( $expected, $response['data'] );
     61        $this->assertSame( $expected, $response['data'] );
    6262    }
    6363
     
    112112        // Ensure everything is correct.
    113113        $this->assertTrue( $response['success'] );
    114         $this->assertEquals( $expected, $response['data'] );
     114        $this->assertSame( $expected, $response['data'] );
    115115    }
    116116}
Note: See TracChangeset for help on using the changeset viewer.