@@ -4069,4 +4069,38 @@ public function data_note_status_provider() {
40694069 'reopen ' => array ( 'reopen ' ),
40704070 );
40714071 }
4072+
4073+ /**
4074+ * Test children link for note comment type.
4075+ *
4076+ * @ticket 64145
4077+ */
4078+ 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+ }
40724106}
0 commit comments