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/sitemaps/sitemaps-posts.php

    r48476 r48937  
    2525        );
    2626
    27         $this->assertEquals( $expected, $post_list );
     27        $this->assertSame( $expected, $post_list );
    2828    }
    2929
     
    3838        $subtypes = $posts_provider->get_object_subtypes();
    3939
    40         $this->assertEquals( array(), $subtypes, 'Could not filter posts subtypes.' );
     40        $this->assertSame( array(), $subtypes, 'Could not filter posts subtypes.' );
    4141    }
    4242
     
    5252        $url_list = $posts_provider->get_url_list( 1, 'page' );
    5353
    54         $this->assertEquals( array(), $url_list );
     54        $this->assertSame( array(), $url_list );
    5555
    5656        update_option( 'show_on_front', 'posts' );
Note: See TracChangeset for help on using the changeset viewer.