mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user