|
@@ 80-85 (lines=6) @@
|
| 77 |
|
/** |
| 78 |
|
* Testing the `POST /jetpack/v4/backup-helper-script` endpoint when the `helper` param is missing. |
| 79 |
|
*/ |
| 80 |
|
public function test_install_backup_helper_script_missing_required_param() { |
| 81 |
|
$request = new WP_REST_Request( 'POST', '/jetpack/v4/backup-helper-script' ); |
| 82 |
|
$response = $this->server->dispatch( $request ); |
| 83 |
|
$this->assertEquals( 400, $response->get_status() ); |
| 84 |
|
$this->assertEquals( 'Missing parameter(s): helper', $response->get_data()['message'] ); |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
/** |
| 88 |
|
* Testing the `POST /jetpack/v4/backup-helper-script` endpoint with admin user. |
|
@@ 131-136 (lines=6) @@
|
| 128 |
|
/** |
| 129 |
|
* Testing the `DELETE /jetpack/v4/backup-helper-script` endpoint when the `path` param is missing. |
| 130 |
|
*/ |
| 131 |
|
public function test_delete_backup_helper_script_missing_required_param() { |
| 132 |
|
$request = new WP_REST_Request( 'DELETE', '/jetpack/v4/backup-helper-script' ); |
| 133 |
|
$response = $this->server->dispatch( $request ); |
| 134 |
|
$this->assertEquals( 400, $response->get_status() ); |
| 135 |
|
$this->assertEquals( 'Missing parameter(s): path', $response->get_data()['message'] ); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
/** |
| 139 |
|
* Testing the `DELETE /jetpack/v4/backup-helper-script` endpoint with admin user. |
|
@@ 252-258 (lines=7) @@
|
| 249 |
|
/** |
| 250 |
|
* Testing the `/jetpack/v4/options/backup` endpoint with invalid params. |
| 251 |
|
*/ |
| 252 |
|
public function test_backup_options_invalid_params() { |
| 253 |
|
$request = new WP_REST_Request( 'GET', '/jetpack/v4/options/backup' ); |
| 254 |
|
$response = $this->server->dispatch( $request ); |
| 255 |
|
|
| 256 |
|
$this->assertEquals( 400, $response->get_status() ); |
| 257 |
|
$this->assertEquals( 'Missing parameter(s): name', $response->get_data()['message'] ); |
| 258 |
|
} |
| 259 |
|
|
| 260 |
|
/** |
| 261 |
|
* Testing the `/jetpack/v4/options/backup` endpoint with admin user. |
|
@@ 281-293 (lines=13) @@
|
| 278 |
|
/** |
| 279 |
|
* Testing the `/jetpack/v4/options/backup` endpoint on success. |
| 280 |
|
*/ |
| 281 |
|
public function test_backup_options_success() { |
| 282 |
|
$request = new WP_REST_Request( 'GET', '/jetpack/v4/options/backup' ); |
| 283 |
|
$request->set_query_params( |
| 284 |
|
array( |
| 285 |
|
'name' => 'home', |
| 286 |
|
) |
| 287 |
|
); |
| 288 |
|
$response = $this->server->dispatch( $request ); |
| 289 |
|
|
| 290 |
|
$response = $this->dispatch_request_signed_with_blog_token( $request ); |
| 291 |
|
|
| 292 |
|
$this->assertEquals( 200, $response->get_status() ); |
| 293 |
|
} |
| 294 |
|
|
| 295 |
|
/** |
| 296 |
|
* Testing the `/jetpack/v4/comments/(?P<id>\d+)/backup` endpoint with admin user. |
|
@@ 311-321 (lines=11) @@
|
| 308 |
|
/** |
| 309 |
|
* Testing the `/jetpack/v4/comments/(?P<id>\d+)/backup` endpoint on success. |
| 310 |
|
*/ |
| 311 |
|
public function test_backup_comment_success() { |
| 312 |
|
$request = new WP_REST_Request( 'GET', '/jetpack/v4/comments/1234/backup' ); |
| 313 |
|
|
| 314 |
|
$response = $this->server->dispatch( $request ); |
| 315 |
|
|
| 316 |
|
$response = $this->dispatch_request_signed_with_blog_token( $request ); |
| 317 |
|
|
| 318 |
|
$this->assertEquals( 404, $response->get_status() ); // success in this context. |
| 319 |
|
|
| 320 |
|
$this->assertEquals( 'Comment not found', $response->get_data()['message'] ); |
| 321 |
|
} |
| 322 |
|
|
| 323 |
|
/** |
| 324 |
|
* Testing the `/jetpack/v4/posts/(?P<id>\d+)/backup` endpoint with admin user. |