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

    r46586 r48937  
    1818        add_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
    1919        $iso8859_1 = 'Fran' . chr( 135 ) . 'ais';
    20         $this->assertEquals( '<p>' . $iso8859_1 . "</p>\n", wp_richedit_pre( $iso8859_1 ) );
     20        $this->assertSame( '<p>' . $iso8859_1 . "</p>\n", wp_richedit_pre( $iso8859_1 ) );
    2121        remove_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
    2222    }
     
    3232        add_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
    3333        $utf8 = 'Fran' . chr( 195 ) . chr( 167 ) . 'ais';
    34         $this->assertEquals( '<p>' . $utf8 . "</p>\n", wp_richedit_pre( $utf8 ) );
     34        $this->assertSame( '<p>' . $utf8 . "</p>\n", wp_richedit_pre( $utf8 ) );
    3535        remove_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
    3636    }
Note: See TracChangeset for help on using the changeset viewer.