post->create(['post_content' => '

original

']); $post = get_post($postId); $user = self::factory()->user->create(); wp_set_current_user($user); $request = new \WP_REST_Request(); $request->set_param('postId', $postId); WPController::lockPost($request); // Attempt to update as the cron user (no user). wp_set_current_user(0); $result = Post::update($post, '

imported content

'); $this->assertWPError($result); $this->assertSame(1005, $result->get_error_code()); $this->assertSame('

original

', get_post($postId)->post_content); } }