Tests: Use more appropriate assertions in various tests.

This replaces instances of `assertSame( [number], count( ... ) )` with `assertCount()` to use native PHPUnit functionality.

Follow-up to [51335], [51337].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51367 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-07-07 10:32:56 +00:00
parent b1f0971ee3
commit e77691036d
63 changed files with 291 additions and 291 deletions

View File

@@ -488,14 +488,14 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
$request->set_param( 'include', array( $id2, $id1 ) );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
$this->assertSame( 2, count( $data ) );
$this->assertCount( 2, $data );
$this->assertSame( $id1, $data[0]['id'] );
// 'orderby' => 'include'.
$request->set_param( 'orderby', 'include' );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
$this->assertSame( 2, count( $data ) );
$this->assertCount( 2, $data );
$this->assertSame( $id2, $data[0]['id'] );
// Invalid 'orderby' should error.
@@ -3156,7 +3156,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
$properties = $data['schema']['properties'];
$this->assertSame( 17, count( $properties ) );
$this->assertCount( 17, $properties );
$this->assertArrayHasKey( 'id', $properties );
$this->assertArrayHasKey( 'author', $properties );
$this->assertArrayHasKey( 'author_avatar_urls', $properties );