@@ -1699,7 +1699,7 @@ public function test_create_comment_with_invalid_type() {
16991699 $ request ->set_body ( wp_json_encode ( $ params ) );
17001700
17011701 $ response = rest_get_server ()->dispatch ( $ request );
1702- $ this ->assertErrorResponse ( 'rest_invalid_param ' , $ response , 400 );
1702+ $ this ->assertErrorResponse ( 'rest_invalid_comment_type ' , $ response , 400 );
17031703 }
17041704
17051705 public function test_create_comment_invalid_email () {
@@ -2716,7 +2716,7 @@ public function test_update_comment_invalid_type() {
27162716 $ request ->set_body ( wp_json_encode ( $ params ) );
27172717
27182718 $ response = rest_get_server ()->dispatch ( $ request );
2719- $ this ->assertErrorResponse ( 'rest_invalid_param ' , $ response , 400 );
2719+ $ this ->assertErrorResponse ( 'rest_comment_invalid_type ' , $ response , 404 );
27202720 }
27212721
27222722 public function test_update_comment_with_raw_property () {
@@ -3305,9 +3305,9 @@ public function test_get_item_schema() {
33053305
33063306 $ this ->assertSame ( 0 , $ properties ['parent ' ]['default ' ] );
33073307 $ this ->assertSame ( 0 , $ properties ['post ' ]['default ' ] );
3308- $ this ->assertSame ( array ( 'comment ' , 'note ' ), $ properties ['type ' ]['enum ' ] );
33093308
33103309 $ this ->assertTrue ( $ properties ['link ' ]['readonly ' ] );
3310+ $ this ->assertTrue ( $ properties ['type ' ]['readonly ' ] );
33113311 }
33123312
33133313 public function test_get_item_schema_show_avatar () {
@@ -3792,8 +3792,10 @@ public function test_create_note_status() {
37923792 */
37933793 public function test_cannot_create_with_non_valid_comment_type () {
37943794 wp_set_current_user ( self ::$ admin_id );
3795+ $ post_id = $ this ->factory ->post ->create ();
37953796
37963797 $ params = array (
3798+ 'post ' => $ post_id ,
37973799 'author_name ' => 'Ishmael ' ,
37983800 'author_email ' =>
'[email protected] ' ,
37993801 'author_url ' => 'https://en.wikipedia.org/wiki/Herman_Melville ' ,
@@ -3807,7 +3809,7 @@ public function test_cannot_create_with_non_valid_comment_type() {
38073809 $ request ->set_body ( wp_json_encode ( $ params ) );
38083810 $ response = rest_get_server ()->dispatch ( $ request );
38093811
3810- $ this ->assertErrorResponse ( 'rest_invalid_param ' , $ response , 400 );
3812+ $ this ->assertErrorResponse ( 'rest_invalid_comment_type ' , $ response , 400 );
38113813 }
38123814
38133815 /**
0 commit comments