WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (17 months 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/xmlrpc/wp/setOptions.php

    r47122 r48937  
    1414
    1515        update_option( 'default_comment_status', 'closed' );
    16         $this->assertEquals( 'closed', get_option( 'default_comment_status' ) );
     16        $this->assertSame( 'closed', get_option( 'default_comment_status' ) );
    1717        $result = $this->myxmlrpcserver->wp_setOptions(
    1818            array(
     
    2828
    2929        $this->assertInternalType( 'array', $result );
    30         $this->assertEquals( $escaped_string_with_quote, $result['blog_title']['value'] );
    31         $this->assertEquals( 'open', $result['default_comment_status']['value'] );
     30        $this->assertSame( $escaped_string_with_quote, $result['blog_title']['value'] );
     31        $this->assertSame( 'open', $result['default_comment_status']['value'] );
    3232    }
    3333}
Note: See TracChangeset for help on using the changeset viewer.