|
@@ 1314-1335 (lines=22) @@
|
| 1311 |
|
/** |
| 1312 |
|
* @ticket 38820 |
| 1313 |
|
*/ |
| 1314 |
|
public function test_create_comment_with_invalid_type() |
| 1315 |
|
{ |
| 1316 |
|
$post_id = $this->factory->post->create(); |
| 1317 |
|
wp_set_current_user(self::$admin_id); |
| 1318 |
|
|
| 1319 |
|
$params = array( |
| 1320 |
|
'post' => $post_id, |
| 1321 |
|
'author' => self::$admin_id, |
| 1322 |
|
'author_name' => 'Comic Book Guy', |
| 1323 |
|
'author_email' => '[email protected]', |
| 1324 |
|
'author_url' => 'http://androidsdungeon.com', |
| 1325 |
|
'content' => 'Worst Comment Ever!', |
| 1326 |
|
'date' => '2014-11-07T10:14:25', |
| 1327 |
|
'type' => 'foo', |
| 1328 |
|
); |
| 1329 |
|
|
| 1330 |
|
$request = new WP_REST_Request('POST', '/wp/v2/comments'); |
| 1331 |
|
$request->add_header('content-type', 'application/json'); |
| 1332 |
|
$request->set_body(wp_json_encode($params)); |
| 1333 |
|
|
| 1334 |
|
$response = $this->server->dispatch($request); |
| 1335 |
|
$this->assertErrorResponse('rest_invalid_comment_type', $response, 400); |
| 1336 |
|
} |
| 1337 |
|
|
| 1338 |
|
public function test_create_comment_invalid_email() |
|
@@ 1338-1358 (lines=21) @@
|
| 1335 |
|
$this->assertErrorResponse('rest_invalid_comment_type', $response, 400); |
| 1336 |
|
} |
| 1337 |
|
|
| 1338 |
|
public function test_create_comment_invalid_email() |
| 1339 |
|
{ |
| 1340 |
|
$post_id = $this->factory->post->create(); |
| 1341 |
|
wp_set_current_user(self::$admin_id); |
| 1342 |
|
|
| 1343 |
|
$params = array( |
| 1344 |
|
'post' => $post_id, |
| 1345 |
|
'author' => self::$admin_id, |
| 1346 |
|
'author_name' => 'Comic Book Guy', |
| 1347 |
|
'author_email' => 'hello:)', |
| 1348 |
|
'author_url' => 'http://androidsdungeon.com', |
| 1349 |
|
'content' => 'Worst Comment Ever!', |
| 1350 |
|
'date' => '2014-11-07T10:14:25', |
| 1351 |
|
); |
| 1352 |
|
|
| 1353 |
|
$request = new WP_REST_Request('POST', '/wp/v2/comments'); |
| 1354 |
|
$request->add_header('content-type', 'application/json'); |
| 1355 |
|
$request->set_body(wp_json_encode($params)); |
| 1356 |
|
|
| 1357 |
|
$response = $this->server->dispatch($request); |
| 1358 |
|
$this->assertErrorResponse('rest_invalid_param', $response, 400); |
| 1359 |
|
} |
| 1360 |
|
|
| 1361 |
|
public function test_create_item_current_user() |