- Timestamp:
- 07/12/2021 10:35:44 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r51397 r51404 476 476 $data = $response->get_data(); 477 477 $ids = wp_list_pluck( $data, 'id' ); 478 $this->assert True( in_array( $id1, $ids, true ));479 $this->assert True( in_array( $id2, $ids, true ));478 $this->assertContains( $id1, $ids ); 479 $this->assertContains( $id2, $ids ); 480 480 481 481 $request->set_param( 'exclude', array( $id2 ) ); … … 483 483 $data = $response->get_data(); 484 484 $ids = wp_list_pluck( $data, 'id' ); 485 $this->assert True( in_array( $id1, $ids, true ));486 $this->assert False( in_array( $id2, $ids, true ));485 $this->assertContains( $id1, $ids ); 486 $this->assertNotContains( $id2, $ids ); 487 487 488 488 $request->set_param( 'exclude', (string) $id2 ); … … 490 490 $data = $response->get_data(); 491 491 $ids = wp_list_pluck( $data, 'id' ); 492 $this->assert True( in_array( $id1, $ids, true ));493 $this->assert False( in_array( $id2, $ids, true ));492 $this->assertContains( $id1, $ids ); 493 $this->assertNotContains( $id2, $ids ); 494 494 495 495 $request->set_param( 'exclude', 'invalid' ); … … 1483 1483 $posts = $response->get_data(); 1484 1484 $ids = wp_list_pluck( $posts, 'id' ); 1485 $this->assert True( in_array( $id1, $ids, true ));1486 $this->assert False( in_array( $id2, $ids, true ));1487 $this->assert False( in_array( $id3, $ids, true ));1485 $this->assertContains( $id1, $ids ); 1486 $this->assertNotContains( $id2, $ids ); 1487 $this->assertNotContains( $id3, $ids); 1488 1488 1489 1489 $this->assertPostsWhere( " AND {posts}.ID NOT IN ($id3,$id2) AND {posts}.post_type = 'post' AND (({posts}.post_status = 'publish'))" ); … … 1509 1509 $posts = $response->get_data(); 1510 1510 $ids = wp_list_pluck( $posts, 'id' ); 1511 $this->assert True( in_array( $id1, $ids, true ));1512 $this->assert True( in_array( $id2, $ids, true ));1513 $this->assert False( in_array( $id3, $ids, true ));1511 $this->assertContains( $id1, $ids ); 1512 $this->assertContains( $id2, $ids ); 1513 $this->assertNotContains( $id3, $ids ); 1514 1514 1515 1515 $this->assertPostsWhere( " AND {posts}.ID NOT IN ($id3) AND {posts}.post_type = 'post' AND (({posts}.post_status = 'publish'))" );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)