|
@@ 420-435 (lines=16) @@
|
| 417 |
|
* |
| 418 |
|
* @covers Automattic\Jetpack\Connection\Manager::update_connection_owner |
| 419 |
|
*/ |
| 420 |
|
public function test_update_connection_owner_non_admin() { |
| 421 |
|
$editor_id = wp_insert_user( |
| 422 |
|
array( |
| 423 |
|
'user_login' => 'editor', |
| 424 |
|
'user_pass' => 'pass', |
| 425 |
|
'user_email' => '[email protected]', |
| 426 |
|
'role' => 'editor', |
| 427 |
|
) |
| 428 |
|
); |
| 429 |
|
|
| 430 |
|
$expected = new WP_Error( 'new_owner_not_admin', __( 'New owner is not admin', 'jetpack' ), array( 'status' => 400 ) ); |
| 431 |
|
|
| 432 |
|
$result = $this->manager->update_connection_owner( $editor_id ); |
| 433 |
|
|
| 434 |
|
$this->assertEquals( $expected, $result ); |
| 435 |
|
} |
| 436 |
|
|
| 437 |
|
/** |
| 438 |
|
* Test updating the connection owner to the existing owner. |
|
@@ 468-483 (lines=16) @@
|
| 465 |
|
* |
| 466 |
|
* @covers Automattic\Jetpack\Connection\Manager::update_connection_owner |
| 467 |
|
*/ |
| 468 |
|
public function test_update_connection_owner_not_connected() { |
| 469 |
|
$admin_id = wp_insert_user( |
| 470 |
|
array( |
| 471 |
|
'user_login' => 'admin', |
| 472 |
|
'user_pass' => 'pass', |
| 473 |
|
'user_email' => '[email protected]', |
| 474 |
|
'role' => 'administrator', |
| 475 |
|
) |
| 476 |
|
); |
| 477 |
|
|
| 478 |
|
$expected = new WP_Error( 'new_owner_not_connected', __( 'New owner is not connected', 'jetpack' ), array( 'status' => 400 ) ); |
| 479 |
|
|
| 480 |
|
$result = $this->manager->update_connection_owner( $admin_id ); |
| 481 |
|
|
| 482 |
|
$this->assertEquals( $expected, $result ); |
| 483 |
|
} |
| 484 |
|
|
| 485 |
|
/** |
| 486 |
|
* Test updating the connection owner when remote call to wpcom fails. |