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:
Sergey Biryukov
2020-11-09 15:43:14 +00:00
parent 2e01c76841
commit 4eee0d2fb7
12 changed files with 106 additions and 106 deletions
@@ -205,7 +205,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
$this->request->set_attributes( array( 'accept_json' => true ) );
// Check that JSON takes precedence.
$this->assertEquals( $source, $this->request->get_param( 'source' ) );
$this->assertSame( $source, $this->request->get_param( 'source' ) );
$this->assertEquals( $accept_json, $this->request->get_param( 'has_json_params' ) );
}
@@ -233,7 +233,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
$this->request->set_header( 'Content-Type', $content_type );
// Check for JSON content-type.
$this->assertEquals( $is_json, $this->request->is_json_content_type() );
$this->assertSame( $is_json, $this->request->is_json_content_type() );
}
/**
@@ -926,6 +926,6 @@ class Tests_REST_Request extends WP_UnitTestCase {
$valid = $request->has_valid_params();
$this->assertWPError( $valid );
$this->assertEquals( 'rest_invalid_param', $valid->get_error_code() );
$this->assertSame( 'rest_invalid_param', $valid->get_error_code() );
}
}