Make WordPress Core


Ignore:
Timestamp:
11/09/2020 03:43:14 PM (6 years 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 [48937], [48939], [48940], [48944].

See #38266.

File:
1 edited

Legend:

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

    r49303 r49547  
    14411441                $response = rest_get_server()->dispatch( $request );
    14421442                $this->assertSame( 201, $response->get_status() );
    1443                 $this->assertEquals( '0', $response->get_data()['content']['raw'] );
     1443                $this->assertSame( '0', $response->get_data()['content']['raw'] );
    14441444        }
    14451445
    … …  
    14661466                $response = rest_get_server()->dispatch( $request );
    14671467                $this->assertSame( 201, $response->get_status() );
    1468                 $this->assertEquals( '', $response->get_data()['content']['raw'] );
     1468                $this->assertSame( '', $response->get_data()['content']['raw'] );
    14691469        }
    14701470
    … …  
    33263326
    33273327                if ( $comment->comment_post_ID ) {
    3328                         $this->assertEquals( rest_url( '/wp/v2/posts/' . $comment->comment_post_ID ), $links['up'][0]['href'] );
     3328                        $this->assertSame( rest_url( '/wp/v2/posts/' . $comment->comment_post_ID ), $links['up'][0]['href'] );
    33293329                }
    33303330
Note: See TracChangeset for help on using the changeset viewer.