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-themes-controller.php

    r49925 r50284  
    200200        $response = rest_get_server()->dispatch( $request );
    201201
    202         $this->assertEquals( 200, $response->get_status() );
     202        $this->assertSame( 200, $response->get_status() );
    203203        $data = $response->get_data();
    204204
     
    238238        $response = rest_get_server()->dispatch( $request );
    239239
    240         $this->assertEquals( 200, $response->get_status() );
     240        $this->assertSame( 200, $response->get_status() );
    241241        $data = $response->get_data();
    242242
     
    298298            $this->assertErrorResponse( $error_code, $response, 403 );
    299299        } else {
    300             $this->assertEquals( 200, $response->get_status() );
     300            $this->assertSame( 200, $response->get_status() );
    301301        }
    302302    }
     
    12161216        $response = rest_get_server()->dispatch( $request );
    12171217
    1218         $this->assertEquals( 200, $response->get_status() );
     1218        $this->assertSame( 200, $response->get_status() );
    12191219        $data         = $response->get_data();
    12201220        $links        = $response->get_links();
     
    12791279        $response = rest_get_server()->dispatch( $request );
    12801280
    1281         $this->assertEquals( 200, $response->get_status() );
     1281        $this->assertSame( 200, $response->get_status() );
    12821282    }
    12831283
Note: See TracChangeset for help on using the changeset viewer.