Skip to content

Commit 7c0cfe1

Browse files
committed
Work around strange user creation issue in factory
1 parent 1869689 commit 7c0cfe1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

plugins/optimization-detective/tests/storage/test-data.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,14 +389,14 @@ static function ( $data ) {
389389

390390
'user_archive' => array(
391391
'set_up' => function (): Closure {
392-
$user = self::factory()->user->create_and_get();
393-
$this->assertInstanceOf( WP_User::class, $user );
394-
$post_ids = self::factory()->post->create_many( 3, array( 'post_author' => $user->ID ) );
395-
$this->go_to( get_author_posts_url( $user->ID ) );
392+
$user_id = self::factory()->user->create();
393+
$this->assertIsInt( $user_id );
394+
$post_ids = self::factory()->post->create_many( 3, array( 'post_author' => $user_id ) );
395+
$this->go_to( get_author_posts_url( $user_id ) );
396396
$GLOBALS['template'] = trailingslashit( get_template_directory() ) . 'author.php';
397397

398-
return function ( array $etag_data ) use ( $user, $post_ids ): void {
399-
$this->assertSame( $user->ID, $etag_data['queried_object']['id'] );
398+
return function ( array $etag_data ) use ( $user_id, $post_ids ): void {
399+
$this->assertSame( $user_id, $etag_data['queried_object']['id'] );
400400
$this->assertSame( 'user', $etag_data['queried_object']['type'] );
401401
$this->assertCount( 3, $etag_data['queried_posts'] );
402402
$this->assertEqualSets( $post_ids, wp_list_pluck( $etag_data['queried_posts'], 'id' ) );

0 commit comments

Comments
 (0)