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

    r48553 r48937  
    225225        $expected = $this->_get_expected_url_list( 'post', self::$posts );
    226226
    227         $this->assertEquals( $expected, $post_list );
     227        $this->assertSame( $expected, $post_list );
    228228    }
    229229
     
    241241        $expected = $this->_get_expected_url_list( 'page', self::$pages );
    242242
    243         $this->assertEquals( $expected, $post_list );
     243        $this->assertSame( $expected, $post_list );
    244244    }
    245245
     
    262262        );
    263263
    264         $this->assertEquals( $expected, $post_list );
     264        $this->assertSame( $expected, $post_list );
    265265    }
    266266
     
    307307        unregister_post_type( $post_type );
    308308
    309         $this->assertEquals( $expected, $post_list, 'Custom post type posts are not visible.' );
     309        $this->assertSame( $expected, $post_list, 'Custom post type posts are not visible.' );
    310310    }
    311311
     
    394394        $sitemaps = wp_get_sitemap_providers();
    395395
    396         $this->assertEquals( $sitemaps['test_sitemap'], self::$test_provider, 'Can not confirm sitemap registration is working.' );
     396        $this->assertSame( $sitemaps['test_sitemap'], self::$test_provider, 'Can not confirm sitemap registration is working.' );
    397397    }
    398398
Note: See TracChangeset for help on using the changeset viewer.