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/canonical/https.php

    r46586 r48937  
    2525     */
    2626    public function test_http_request_with_http_home() {
    27 
    2827        $redirect = redirect_canonical( $this->http, false );
    2928
    30         $this->assertEquals( $redirect, false );
    31 
     29        $this->assertNull( $redirect );
    3230    }
    3331
     
    3634     */
    3735    public function test_https_request_with_http_home() {
    38 
    3936        $redirect = redirect_canonical( $this->https, false );
    4037
    41         $this->assertEquals( $redirect, false );
    42 
     38        $this->assertNull( $redirect );
    4339    }
    4440
     
    4743     */
    4844    public function test_https_request_with_https_home() {
    49 
    5045        add_filter( 'home_url', array( $this, 'set_https' ) );
    5146
    5247        $redirect = redirect_canonical( $this->https, false );
    5348
    54         $this->assertEquals( $redirect, false );
     49        $this->assertNull( $redirect );
    5550
    5651        remove_filter( 'home_url', array( $this, 'set_https' ) );
    57 
    5852    }
    5953
Note: See TracChangeset for help on using the changeset viewer.