Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (4 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/rewrite/oldSlugRedirect.php

    r46586 r48937  
    5252        $this->go_to( $old_permalink );
    5353        wp_old_slug_redirect();
    54         $this->assertEquals( $permalink, $this->old_slug_redirect_url );
     54        $this->assertSame( $permalink, $this->old_slug_redirect_url );
    5555    }
    5656
     
    9393        $this->go_to( $old_permalink );
    9494        wp_old_slug_redirect();
    95         $this->assertEquals( $permalink, $this->old_slug_redirect_url );
     95        $this->assertSame( $permalink, $this->old_slug_redirect_url );
    9696    }
    9797
     
    117117        $this->go_to( $old_permalink );
    118118        wp_old_slug_redirect();
    119         $this->assertEquals( $permalink, $this->old_slug_redirect_url );
     119        $this->assertSame( $permalink, $this->old_slug_redirect_url );
    120120    }
    121121
     
    142142        $permalink = user_trailingslashit( get_permalink( $new_post_id ) );
    143143
    144         $this->assertEquals( $old_permalink, $permalink );
     144        $this->assertSame( $old_permalink, $permalink );
    145145
    146146        $this->go_to( $old_permalink );
Note: See TracChangeset for help on using the changeset viewer.