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

    r46586 r48937  
    1717        add_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
    1818        $iso8859_1 = 'Fran' . chr( 135 ) . 'ais';
    19         $this->assertEquals( $iso8859_1, esc_textarea( $iso8859_1 ) );
     19        $this->assertSame( $iso8859_1, esc_textarea( $iso8859_1 ) );
    2020        remove_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
    2121    }
     
    3131        add_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
    3232        $utf8 = 'Fran' . chr( 195 ) . chr( 167 ) . 'ais';
    33         $this->assertEquals( $utf8, esc_textarea( $utf8 ) );
     33        $this->assertSame( $utf8, esc_textarea( $utf8 ) );
    3434        remove_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
    3535    }
Note: See TracChangeset for help on using the changeset viewer.