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-application-passwords-controller.php

    r50114 r50284  
    892892        $this->assertNotWPError( $response->as_error() );
    893893
    894         $this->assertEquals( $password['uuid'], $response->get_data()['uuid'] );
     894        $this->assertSame( $password['uuid'], $response->get_data()['uuid'] );
    895895    }
    896896
     
    902902        $response = rest_do_request( '/wp/v2/users/' . self::$admin . '/application-passwords/introspect' );
    903903
    904         $this->assertEquals( $password['uuid'], $response->get_data()['uuid'] );
     904        $this->assertSame( $password['uuid'], $response->get_data()['uuid'] );
    905905    }
    906906
Note: See TracChangeset for help on using the changeset viewer.