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

    r46586 r48937  
    232232
    233233    public function test_front_page_template_hierarchy_with_posts_on_front() {
    234         $this->assertEquals( 'posts', get_option( 'show_on_front' ) );
     234        $this->assertSame( 'posts', get_option( 'show_on_front' ) );
    235235        $this->assertTemplateHierarchy(
    236236            home_url(),
     
    462462        $hierarchy = $this->get_template_hierarchy();
    463463
    464         $this->assertEquals( $expected, $hierarchy, $message );
     464        $this->assertSame( $expected, $hierarchy, $message );
    465465    }
    466466
Note: See TracChangeset for help on using the changeset viewer.