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/getPostCommentsFeedLink.php

    r46586 r48937  
    1717        );
    1818
    19         $this->assertEquals( $expected, $link );
     19        $this->assertSame( $expected, $link );
    2020    }
    2121
     
    2828        $expected = get_permalink( $post_id ) . 'feed/';
    2929
    30         $this->assertEquals( $expected, $link );
     30        $this->assertSame( $expected, $link );
    3131    }
    3232
     
    5151        );
    5252
    53         $this->assertEquals( $expected, $link );
     53        $this->assertSame( $expected, $link );
    5454    }
    5555
     
    7777        $expected = get_permalink( $post_id ) . 'burrito/feed/';
    7878
    79         $this->assertEquals( $expected, $link );
     79        $this->assertSame( $expected, $link );
    8080    }
    8181
     
    9696        $expected = get_permalink( $post_id ) . 'attachment/' . $attachment_id . '/feed/';
    9797
    98         $this->assertEquals( $expected, $link );
     98        $this->assertSame( $expected, $link );
    9999    }
    100100
     
    118118        );
    119119
    120         $this->assertEquals( $expected, $link );
     120        $this->assertSame( $expected, $link );
    121121    }
    122122
     
    136136        $expected = add_query_arg( 'attachment_id', $attachment_id, home_url( '/feed/' ) );
    137137
    138         $this->assertEquals( $expected, $link );
     138        $this->assertSame( $expected, $link );
    139139    }
    140140}
Note: See TracChangeset for help on using the changeset viewer.