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

    r48872 r48937  
    1616        $expected_users      = wp_sitemaps_get_max_urls( 'user' );
    1717
    18         $this->assertEquals( $expected_posts, 300, 'Can not confirm max URL number for posts.' );
    19         $this->assertEquals( $expected_taxonomies, 50, 'Can not confirm max URL number for taxonomies.' );
    20         $this->assertEquals( $expected_users, 1, 'Can not confirm max URL number for users.' );
     18        $this->assertSame( $expected_posts, 300, 'Can not confirm max URL number for posts.' );
     19        $this->assertSame( $expected_taxonomies, 50, 'Can not confirm max URL number for taxonomies.' );
     20        $this->assertSame( $expected_users, 1, 'Can not confirm max URL number for users.' );
    2121    }
    2222
     
    5353        );
    5454
    55         $this->assertEquals( array_keys( $expected ), array_keys( $sitemaps ), 'Unable to confirm default sitemap types are registered.' );
     55        $this->assertSame( array_keys( $expected ), array_keys( $sitemaps ), 'Unable to confirm default sitemap types are registered.' );
    5656
    5757        foreach ( $expected as $name => $provider ) {
Note: See TracChangeset for help on using the changeset viewer.