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

    r46586 r48937  
    2626        $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'username', 'password' ) );
    2727        $this->assertIXRError( $result );
    28         $this->assertEquals( 403, $result->code );
     28        $this->assertSame( 403, $result->code );
    2929    }
    3030
     
    3434        $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'contributor', 'contributor' ) );
    3535        $this->assertIXRError( $result );
    36         $this->assertEquals( 401, $result->code );
     36        $this->assertSame( 401, $result->code );
    3737    }
    3838
     
    5050            $this->assertInstanceOf( 'IXR_Date', $result->date_created_gmt );
    5151
    52             $this->assertEquals( strtotime( $page->post_date ), $result->dateCreated->getTimestamp() );
    53             $this->assertEquals( $date_gmt, $result->date_created_gmt->getTimestamp() );
     52            $this->assertSame( strtotime( $page->post_date ), $result->dateCreated->getTimestamp() );
     53            $this->assertSame( $date_gmt, $result->date_created_gmt->getTimestamp() );
    5454        }
    5555    }
Note: See TracChangeset for help on using the changeset viewer.