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/link/getDashboardUrl.php

    r47012 r48937  
    2323     */
    2424    public function test_get_dashboard_url_for_current_site_user() {
    25         $this->assertEquals( admin_url(), get_dashboard_url( self::$user_id ) );
     25        $this->assertSame( admin_url(), get_dashboard_url( self::$user_id ) );
    2626    }
    2727
     
    3434        $expected = is_multisite() ? user_admin_url() : admin_url();
    3535
    36         $this->assertEquals( $expected, get_dashboard_url( self::$user_id ) );
     36        $this->assertSame( $expected, get_dashboard_url( self::$user_id ) );
    3737    }
    3838
     
    5151        revoke_super_admin( self::$user_id );
    5252
    53         $this->assertEquals( $expected, $result );
     53        $this->assertSame( $expected, $result );
    5454    }
    5555
     
    7171        wp_delete_site( $site_id );
    7272
    73         $this->assertEquals( $expected, $result );
     73        $this->assertSame( $expected, $result );
    7474    }
    7575}
Note: See TracChangeset for help on using the changeset viewer.