You are here

private function UserTest::sendDeleteRequestForUser in Drupal 10

Parameters

\Drupal\user\UserInterface $account: The user account.

string $cancel_method: The cancel method.

File

core/modules/jsonapi/tests/src/Functional/UserTest.php, line 812

Class

UserTest
JSON:API integration test for the "User" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

private function sendDeleteRequestForUser(UserInterface $account, string $cancel_method) {
  $url = Url::fromRoute(sprintf('jsonapi.%s.individual', static::$resourceTypeName), [
    'entity' => $account
      ->uuid(),
  ]);
  $request_options = [];
  $request_options[RequestOptions::HEADERS]['Accept'] = 'application/vnd.api+json';
  $request_options = NestedArray::mergeDeep($request_options, $this
    ->getAuthenticationRequestOptions());
  $this
    ->setUpAuthorization('DELETE');
  $response = $this
    ->request('DELETE', $url, $request_options);
  $this
    ->assertResourceResponse(204, NULL, $response);
}