Changeset 53936
- Timestamp:
- 08/24/2022 01:18:31 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-users-controller.php
r53510 r53936 1110 1110 1111 1111 public function test_get_item_published_author_post() { 1112 $ this->author_id = $this->factory->user->create(1112 $author_id = $this->factory->user->create( 1113 1113 array( 1114 1114 'role' => 'author', … … 1116 1116 ); 1117 1117 1118 $ this->post_id = $this->factory->post->create(1119 array( 1120 'post_author' => $ this->author_id,1118 $post_id = $this->factory->post->create( 1119 array( 1120 'post_author' => $author_id, 1121 1121 ) 1122 1122 ); … … 1124 1124 wp_set_current_user( 0 ); 1125 1125 1126 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/users/%d', $ this->author_id ) );1126 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/users/%d', $author_id ) ); 1127 1127 $response = rest_get_server()->dispatch( $request ); 1128 1128 $this->check_get_user_response( $response, 'embed' ); … … 1130 1130 1131 1131 public function test_get_item_published_author_pages() { 1132 $ this->author_id = $this->factory->user->create(1132 $author_id = $this->factory->user->create( 1133 1133 array( 1134 1134 'role' => 'author', … … 1138 1138 wp_set_current_user( 0 ); 1139 1139 1140 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/users/%d', $ this->author_id ) );1140 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/users/%d', $author_id ) ); 1141 1141 $response = rest_get_server()->dispatch( $request ); 1142 1142 $this->assertSame( 401, $response->get_status() ); 1143 1143 1144 $ this->post_id = $this->factory->post->create(1145 array( 1146 'post_author' => $ this->author_id,1144 $post_id = $this->factory->post->create( 1145 array( 1146 'post_author' => $author_id, 1147 1147 'post_type' => 'page', 1148 1148 ) … … 1165 1165 1166 1166 public function test_get_item_published_author_wrong_context() { 1167 $ this->author_id = $this->factory->user->create(1167 $author_id = $this->factory->user->create( 1168 1168 array( 1169 1169 'role' => 'author', … … 1171 1171 ); 1172 1172 1173 $ this->post_id = $this->factory->post->create(1174 array( 1175 'post_author' => $ this->author_id,1173 $post_id = $this->factory->post->create( 1174 array( 1175 'post_author' => $author_id, 1176 1176 ) 1177 1177 ); … … 1179 1179 wp_set_current_user( 0 ); 1180 1180 1181 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/users/%d', $ this->author_id ) );1181 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/users/%d', $author_id ) ); 1182 1182 $request->set_param( 'context', 'edit' ); 1183 1183 $response = rest_get_server()->dispatch( $request );
Note: See TracChangeset
for help on using the changeset viewer.