WordPress.org

Make WordPress Core


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

    r46586 r48937  
    77
    88    function test_wp_basename_unix() {
    9         $this->assertEquals(
     9        $this->assertSame(
    1010            'file',
    1111            wp_basename( '/home/test/file' )
     
    1414
    1515    function test_wp_basename_unix_utf8_support() {
    16         $this->assertEquals(
     16        $this->assertSame(
    1717            'žluťoučký kůň.txt',
    1818            wp_basename( '/test/žluťoučký kůň.txt' )
     
    2424     */
    2525    function test_wp_basename_windows() {
    26         $this->assertEquals(
     26        $this->assertSame(
    2727            'file.txt',
    2828            wp_basename( 'C:\Documents and Settings\User\file.txt' )
     
    3434     */
    3535    function test_wp_basename_windows_utf8_support() {
    36         $this->assertEquals(
     36        $this->assertSame(
    3737            'щипцы.txt',
    3838            wp_basename( 'C:\test\щипцы.txt' )
Note: See TracChangeset for help on using the changeset viewer.