Skip to content

Commit 408b270

Browse files
Combine related tests
1 parent eb431aa commit 408b270

File tree

1 file changed

+7
-34
lines changed

1 file changed

+7
-34
lines changed

tests/phpunit/tests/rest-api/rest-comments-controller.php

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4076,40 +4076,6 @@ public function data_note_status_provider() {
40764076
* @ticket 64152
40774077
*/
40784078
public function test_get_note_with_children_link() {
4079-
$comment_id_1 = self::factory()->comment->create(
4080-
array(
4081-
'comment_approved' => 0,
4082-
'comment_post_ID' => self::$post_id,
4083-
'user_id' => self::$subscriber_id,
4084-
'comment_type' => 'note',
4085-
)
4086-
);
4087-
4088-
self::factory()->comment->create(
4089-
array(
4090-
'comment_approved' => 0,
4091-
'comment_parent' => $comment_id_1,
4092-
'comment_post_ID' => self::$post_id,
4093-
'user_id' => self::$subscriber_id,
4094-
'comment_type' => 'note',
4095-
)
4096-
);
4097-
wp_set_current_user( self::$admin_id );
4098-
$request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/comments/%s', $comment_id_1 ) );
4099-
$request->set_param( 'type', 'note' );
4100-
$request->set_param( 'context', 'edit' );
4101-
$response = rest_get_server()->dispatch( $request );
4102-
$this->assertSame( 200, $response->get_status() );
4103-
4104-
$this->assertArrayHasKey( 'children', $response->get_links() );
4105-
}
4106-
4107-
/**
4108-
* Test that children note links are properly embedded in the REST API response.
4109-
*
4110-
* @ticket 64145
4111-
*/
4112-
public function test_get_note_with_embedded_children() {
41134079
$parent_comment_id = self::factory()->comment->create(
41144080
array(
41154081
'comment_approved' => 1,
@@ -4132,6 +4098,13 @@ public function test_get_note_with_embedded_children() {
41324098
);
41334099

41344100
wp_set_current_user( self::$admin_id );
4101+
$request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/comments/%s', $parent_comment_id ) );
4102+
$request->set_param( 'type', 'note' );
4103+
$request->set_param( 'context', 'edit' );
4104+
$response = rest_get_server()->dispatch( $request );
4105+
$this->assertSame( 200, $response->get_status() );
4106+
4107+
$this->assertArrayHasKey( 'children', $response->get_links() );
41354108

41364109
$request = new WP_REST_Request( 'GET', '/wp/v2/comments' );
41374110
$request->set_param( 'post', self::$post_id );

0 commit comments

Comments
 (0)