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

    r47198 r48937  
    145145
    146146        // Check the site option is not changed due to lack of nonce.
    147         $this->assertEquals( 0, get_site_option( 'can_compress_scripts' ) );
     147        $this->assertSame( 0, get_site_option( 'can_compress_scripts' ) );
    148148
    149149        // Add a nonce.
     
    158158
    159159        // Check the site option is changed.
    160         $this->assertEquals( 1, get_site_option( 'can_compress_scripts' ) );
     160        $this->assertSame( 1, get_site_option( 'can_compress_scripts' ) );
    161161    }
    162162
     
    183183
    184184        // Check the site option is not changed due to lack of nonce.
    185         $this->assertEquals( 1, get_site_option( 'can_compress_scripts' ) );
     185        $this->assertSame( 1, get_site_option( 'can_compress_scripts' ) );
    186186
    187187        // Add a nonce.
     
    196196
    197197        // Check the site option is changed.
    198         $this->assertEquals( 0, get_site_option( 'can_compress_scripts' ) );
     198        $this->assertSame( 0, get_site_option( 'can_compress_scripts' ) );
    199199    }
    200200
Note: See TracChangeset for help on using the changeset viewer.