mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@49547 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1440,7 +1440,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$this->assertSame( 201, $response->get_status() );
|
||||
$this->assertEquals( '0', $response->get_data()['content']['raw'] );
|
||||
$this->assertSame( '0', $response->get_data()['content']['raw'] );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1465,7 +1465,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$this->assertSame( 201, $response->get_status() );
|
||||
$this->assertEquals( '', $response->get_data()['content']['raw'] );
|
||||
$this->assertSame( '', $response->get_data()['content']['raw'] );
|
||||
}
|
||||
|
||||
public function test_create_item_invalid_date() {
|
||||
@@ -3325,7 +3325,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
);
|
||||
|
||||
if ( $comment->comment_post_ID ) {
|
||||
$this->assertEquals( rest_url( '/wp/v2/posts/' . $comment->comment_post_ID ), $links['up'][0]['href'] );
|
||||
$this->assertSame( rest_url( '/wp/v2/posts/' . $comment->comment_post_ID ), $links['up'][0]['href'] );
|
||||
}
|
||||
|
||||
if ( 'edit' === $context ) {
|
||||
|
||||
Reference in New Issue
Block a user