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/formatting/CapitalPDangit.php

    r46586 r48937  
    88    function test_esc_attr_quotes() {
    99        global $wp_current_filter;
    10         $this->assertEquals( 'Something about WordPress', capital_P_dangit( 'Something about Wordpress' ) );
    11         $this->assertEquals( 'Something about (WordPress', capital_P_dangit( 'Something about (Wordpress' ) );
    12         $this->assertEquals( 'Something about ‘WordPress', capital_P_dangit( 'Something about ‘Wordpress' ) );
    13         $this->assertEquals( 'Something about “WordPress', capital_P_dangit( 'Something about “Wordpress' ) );
    14         $this->assertEquals( 'Something about >WordPress', capital_P_dangit( 'Something about >Wordpress' ) );
    15         $this->assertEquals( 'Wordpress', capital_P_dangit( 'Wordpress' ) );
     10        $this->assertSame( 'Something about WordPress', capital_P_dangit( 'Something about Wordpress' ) );
     11        $this->assertSame( 'Something about (WordPress', capital_P_dangit( 'Something about (Wordpress' ) );
     12        $this->assertSame( 'Something about ‘WordPress', capital_P_dangit( 'Something about ‘Wordpress' ) );
     13        $this->assertSame( 'Something about “WordPress', capital_P_dangit( 'Something about “Wordpress' ) );
     14        $this->assertSame( 'Something about >WordPress', capital_P_dangit( 'Something about >Wordpress' ) );
     15        $this->assertSame( 'Wordpress', capital_P_dangit( 'Wordpress' ) );
    1616
    1717        $wp_current_filter = array( 'the_title' );
    18         $this->assertEquals( 'WordPress', capital_P_dangit( 'Wordpress' ) );
     18        $this->assertSame( 'WordPress', capital_P_dangit( 'Wordpress' ) );
    1919    }
    2020}
Note: See TracChangeset for help on using the changeset viewer.