|
@@ 74-87 (lines=14) @@
|
| 71 |
|
), $keys ); |
| 72 |
|
} |
| 73 |
|
|
| 74 |
|
public function test_get_items() { |
| 75 |
|
wp_set_current_user( $this->user ); |
| 76 |
|
|
| 77 |
|
$request = new WP_REST_Request( 'GET', '/wp/v2/users' ); |
| 78 |
|
$request->set_param( 'context', 'view' ); |
| 79 |
|
$response = $this->server->dispatch( $request ); |
| 80 |
|
|
| 81 |
|
$this->assertEquals( 200, $response->get_status() ); |
| 82 |
|
|
| 83 |
|
$all_data = $response->get_data(); |
| 84 |
|
$data = $all_data[0]; |
| 85 |
|
$userdata = get_userdata( $data['id'] ); |
| 86 |
|
$this->check_user_data( $userdata, $data, 'view', $data['_links'] ); |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
public function test_get_items_with_edit_context() { |
| 90 |
|
wp_set_current_user( $this->user ); |
|
@@ 89-102 (lines=14) @@
|
| 86 |
|
$this->check_user_data( $userdata, $data, 'view', $data['_links'] ); |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
public function test_get_items_with_edit_context() { |
| 90 |
|
wp_set_current_user( $this->user ); |
| 91 |
|
|
| 92 |
|
$request = new WP_REST_Request( 'GET', '/wp/v2/users' ); |
| 93 |
|
$request->set_param( 'context', 'edit' ); |
| 94 |
|
$response = $this->server->dispatch( $request ); |
| 95 |
|
|
| 96 |
|
$this->assertEquals( 200, $response->get_status() ); |
| 97 |
|
|
| 98 |
|
$all_data = $response->get_data(); |
| 99 |
|
$data = $all_data[0]; |
| 100 |
|
$userdata = get_userdata( $data['id'] ); |
| 101 |
|
$this->check_user_data( $userdata, $data, 'edit', $data['_links'] ); |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
public function test_get_items_with_edit_context_without_permission() { |
| 105 |
|
//test with a user not logged in |