Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (3 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/option/userSettings.php

    r47122 r48937  
    2828        $this->set_user_setting( 'foo', 'bar' );
    2929
    30         $this->assertEquals( 'bar', get_user_setting( 'foo' ) );
     30        $this->assertSame( 'bar', get_user_setting( 'foo' ) );
    3131    }
    3232
     
    3838        $this->set_user_setting( 'foo', 'foo-bar-baz' );
    3939
    40         $this->assertEquals( 'foo-bar-baz', get_user_setting( 'foo' ) );
     40        $this->assertSame( 'foo-bar-baz', get_user_setting( 'foo' ) );
    4141    }
    4242
     
    4848        $this->set_user_setting( 'foo', 'foo*bar*baz' );
    4949
    50         $this->assertEquals( 'foobarbaz', get_user_setting( 'foo' ) );
     50        $this->assertSame( 'foobarbaz', get_user_setting( 'foo' ) );
    5151    }
    5252
Note: See TracChangeset for help on using the changeset viewer.