@@ -656,8 +656,8 @@ public function test_get_items_offset() {
656656 public function test_get_items_include_query () {
657657 wp_set_current_user ( self ::$ user );
658658
659- $ id1 = self ::factory ()-> user -> create () ;
660- $ id2 = self ::factory ()-> user -> create () ;
659+ $ id1 = self ::$ author ;
660+ $ id2 = self ::$ subscriber ;
661661
662662 $ request = new WP_REST_Request ( 'GET ' , '/wp/v2/users ' );
663663
@@ -691,8 +691,8 @@ public function test_get_items_include_query() {
691691 public function test_get_items_exclude_query () {
692692 wp_set_current_user ( self ::$ user );
693693
694- $ id1 = self ::factory ()-> user -> create () ;
695- $ id2 = self ::factory ()-> user -> create () ;
694+ $ id1 = self ::$ subscriber ;
695+ $ id2 = self ::$ author ;
696696
697697 $ request = new WP_REST_Request ( 'GET ' , '/wp/v2/users ' );
698698 $ request ->set_param ( 'per_page ' , self ::$ per_page ); // There are >10 users at this point.
@@ -1089,7 +1089,7 @@ public function test_get_items_who_unauthorized_query() {
10891089 }
10901090
10911091 public function test_get_item () {
1092- $ user_id = self ::factory ()-> user -> create () ;
1092+ $ user_id = self ::$ subscriber ;
10931093
10941094 wp_set_current_user ( self ::$ user );
10951095
@@ -1242,11 +1242,7 @@ public function test_cannot_get_item_author_of_draft() {
12421242 }
12431243
12441244 public function test_get_item_published_author_post () {
1245- $ author_id = self ::factory ()->user ->create (
1246- array (
1247- 'role ' => 'author ' ,
1248- )
1249- );
1245+ $ author_id = self ::$ author ;
12501246
12511247 $ post_id = self ::factory ()->post ->create (
12521248 array (
@@ -1262,11 +1258,7 @@ public function test_get_item_published_author_post() {
12621258 }
12631259
12641260 public function test_get_item_published_author_pages () {
1265- $ author_id = self ::factory ()->user ->create (
1266- array (
1267- 'role ' => 'author ' ,
1268- )
1269- );
1261+ $ author_id = self ::$ author ;
12701262
12711263 wp_set_current_user ( 0 );
12721264
@@ -1286,7 +1278,7 @@ public function test_get_item_published_author_pages() {
12861278 }
12871279
12881280 public function test_get_user_with_edit_context () {
1289- $ user_id = self ::factory ()-> user -> create () ;
1281+ $ user_id = self ::$ subscriber ;
12901282
12911283 $ this ->allow_user_to_manage_multisite ();
12921284
@@ -1297,11 +1289,7 @@ public function test_get_user_with_edit_context() {
12971289 }
12981290
12991291 public function test_get_item_published_author_wrong_context () {
1300- $ author_id = self ::factory ()->user ->create (
1301- array (
1302- 'role ' => 'author ' ,
1303- )
1304- );
1292+ $ author_id = self ::$ author ;
13051293
13061294 $ post_id = self ::factory ()->post ->create (
13071295 array (
@@ -2183,11 +2171,7 @@ public function test_update_user_invalid_id() {
21832171 * @ticket 40263
21842172 */
21852173 public function test_update_item_only_roles_as_editor () {
2186- $ user_id = self ::factory ()->user ->create (
2187- array (
2188- 'role ' => 'author ' ,
2189- )
2190- );
2174+ $ user_id = self ::$ author ;
21912175
21922176 wp_set_current_user ( self ::$ editor );
21932177
@@ -2595,7 +2579,7 @@ public function test_delete_current_item_no_trash() {
25952579 }
25962580
25972581 public function test_delete_user_without_permission () {
2598- $ user_id = self ::factory ()-> user -> create () ;
2582+ $ user_id = self ::$ subscriber ;
25992583
26002584 $ this ->allow_user_to_manage_multisite ();
26012585
@@ -3316,7 +3300,7 @@ public function test_get_items_only_fetches_ids_for_head_requests( $method ) {
33163300 * @param string $path The path to test.
33173301 */
33183302 public function test_head_request_with_specified_fields_returns_success_response ( $ path ) {
3319- $ user_id = self ::factory ()-> user -> create () ;
3303+ $ user_id = self ::$ subscriber ;
33203304 wp_set_current_user ( self ::$ user );
33213305
33223306 $ request = new WP_REST_Request ( 'HEAD ' , sprintf ( $ path , $ user_id ) );
0 commit comments