@@ 1087-1099 (lines=13) @@ | ||
1084 | $this->assertEquals( $params['date_gmt'], mysql_to_rfc3339( $updated->comment_date_gmt ) ); |
|
1085 | } |
|
1086 | ||
1087 | public function test_update_comment_invalid_type() { |
|
1088 | wp_set_current_user( $this->admin_id ); |
|
1089 | ||
1090 | $params = array( |
|
1091 | 'type' => 'trackback', |
|
1092 | ); |
|
1093 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', $this->approved_id ) ); |
|
1094 | $request->add_header( 'content-type', 'application/json' ); |
|
1095 | $request->set_body( wp_json_encode( $params ) ); |
|
1096 | ||
1097 | $response = $this->server->dispatch( $request ); |
|
1098 | $this->assertErrorResponse( 'rest_comment_invalid_type', $response, 404 ); |
|
1099 | } |
|
1100 | ||
1101 | public function test_update_item_invalid_date() { |
|
1102 | wp_set_current_user( $this->admin_id ); |
|
@@ 1101-1115 (lines=15) @@ | ||
1098 | $this->assertErrorResponse( 'rest_comment_invalid_type', $response, 404 ); |
|
1099 | } |
|
1100 | ||
1101 | public function test_update_item_invalid_date() { |
|
1102 | wp_set_current_user( $this->admin_id ); |
|
1103 | ||
1104 | $params = array( |
|
1105 | 'content' => rand_str(), |
|
1106 | 'date' => rand_str(), |
|
1107 | ); |
|
1108 | ||
1109 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', $this->approved_id ) ); |
|
1110 | $request->add_header( 'content-type', 'application/json' ); |
|
1111 | $request->set_body( wp_json_encode( $params ) ); |
|
1112 | ||
1113 | $response = $this->server->dispatch( $request ); |
|
1114 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
|
1115 | } |
|
1116 | ||
1117 | public function test_update_item_invalid_date_gmt() { |
|
1118 | wp_set_current_user( $this->admin_id ); |
|
@@ 1117-1131 (lines=15) @@ | ||
1114 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
|
1115 | } |
|
1116 | ||
1117 | public function test_update_item_invalid_date_gmt() { |
|
1118 | wp_set_current_user( $this->admin_id ); |
|
1119 | ||
1120 | $params = array( |
|
1121 | 'content' => rand_str(), |
|
1122 | 'date_gmt' => rand_str(), |
|
1123 | ); |
|
1124 | ||
1125 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', $this->approved_id ) ); |
|
1126 | $request->add_header( 'content-type', 'application/json' ); |
|
1127 | $request->set_body( wp_json_encode( $params ) ); |
|
1128 | ||
1129 | $response = $this->server->dispatch( $request ); |
|
1130 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
|
1131 | } |
|
1132 | ||
1133 | public function test_update_comment_invalid_id() { |
|
1134 | wp_set_current_user( 0 ); |