WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/10/2021 01:24:24 PM (10 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in some newly introduced 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.

Follow-up to [49904], [49925], [49992], [50012], [50013], [50065], [50075], [50131], [50150], [50157].

See #38266, #52482.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-server.php

    r50150 r50284  
    466466        $response = rest_convert_error_to_response( $error );
    467467        $this->assertSame( 400, $response->get_status() );
    468         $this->assertEquals( 'more_data', $response->get_data()['data'] );
    469         $this->assertEquals( array( array( 'status' => 400 ) ), $response->get_data()['additional_data'] );
     468        $this->assertSame( 'more_data', $response->get_data()['data'] );
     469        $this->assertSame( array( array( 'status' => 400 ) ), $response->get_data()['additional_data'] );
    470470    }
    471471
Note: See TracChangeset for help on using the changeset viewer.