mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( in_array( ... ) )` with `assertContains()` to use native PHPUnit functionality. Follow-up to [51335], [51337], [51367], [51397], [51403]. Props hellofromTonya, jrf, SergeyBiryukov. Fixes #53123. See #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@51404 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -302,9 +302,9 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
|
||||
$data = $response->get_data();
|
||||
$this->assertCount( 2, $data );
|
||||
$ids = wp_list_pluck( $data, 'id' );
|
||||
$this->assertTrue( in_array( $id1, $ids, true ) );
|
||||
$this->assertFalse( in_array( $id2, $ids, true ) );
|
||||
$this->assertTrue( in_array( $id3, $ids, true ) );
|
||||
$this->assertContains( $id1, $ids );
|
||||
$this->assertNotContains( $id2, $ids );
|
||||
$this->assertContains( $id3, $ids );
|
||||
|
||||
$this->check_get_posts_response( $response );
|
||||
}
|
||||
@@ -343,9 +343,9 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
|
||||
$data = $response->get_data();
|
||||
$this->assertCount( 3, $data );
|
||||
$ids = wp_list_pluck( $data, 'id' );
|
||||
$this->assertTrue( in_array( $id1, $ids, true ) );
|
||||
$this->assertTrue( in_array( $id2, $ids, true ) );
|
||||
$this->assertTrue( in_array( $id3, $ids, true ) );
|
||||
$this->assertContains( $id1, $ids );
|
||||
$this->assertContains( $id2, $ids );
|
||||
$this->assertContains( $id3, $ids );
|
||||
}
|
||||
|
||||
public function test_get_items_media_type() {
|
||||
|
||||
Reference in New Issue
Block a user