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/term/wpUniqueTermSlug.php

    r46586 r48937  
    2121
    2222        $actual = wp_unique_term_slug( 'bar', $term );
    23         $this->assertEquals( 'bar', $actual );
     23        $this->assertSame( 'bar', $actual );
    2424    }
    2525
     
    4343
    4444        $actual = wp_unique_term_slug( 'bar', $term2_object );
    45         $this->assertEquals( 'bar', $actual );
     45        $this->assertSame( 'bar', $actual );
    4646    }
    4747
     
    6565
    6666        $actual = wp_unique_term_slug( 'bar', $term2_object );
    67         $this->assertEquals( 'bar-2', $actual );
     67        $this->assertSame( 'bar-2', $actual );
    6868    }
    6969
     
    9696
    9797        $actual = wp_unique_term_slug( 'bar', $term2_object );
    98         $this->assertEquals( 'bar-parent-term', $actual );
     98        $this->assertSame( 'bar-parent-term', $actual );
    9999    }
    100100
     
    126126
    127127        $actual = wp_unique_term_slug( 'bar', $term2_object );
    128         $this->assertEquals( 'bar-2', $actual );
     128        $this->assertSame( 'bar-2', $actual );
    129129    }
    130130
Note: See TracChangeset for help on using the changeset viewer.