function UserTest::sendDeleteRequestForUser

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/UserTest.php \Drupal\Tests\jsonapi\Functional\UserTest::sendDeleteRequestForUser()
  2. 11.x core/modules/jsonapi/tests/src/Functional/UserTest.php \Drupal\Tests\jsonapi\Functional\UserTest::sendDeleteRequestForUser()

Parameters

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

string $cancel_method: The cancel method.

4 calls to UserTest::sendDeleteRequestForUser()
UserTest::testDeleteRespectsUserCancelBlock in core/modules/jsonapi/tests/src/Functional/UserTest.php
Tests if JSON:API respects user.settings.cancel_method: user_cancel_block.
UserTest::testDeleteRespectsUserCancelBlockUnpublish in core/modules/jsonapi/tests/src/Functional/UserTest.php
Tests if JSON:API respects user.settings.cancel_method: user_cancel_block_unpublish.
UserTest::testDeleteRespectsUserCancelBlockUnpublishAndProcessesBatches in core/modules/jsonapi/tests/src/Functional/UserTest.php
Tests if JSON:API respects user.settings.cancel_method: user_cancel_block_unpublish. @group jsonapi
UserTest::testDeleteRespectsUserCancelReassign in core/modules/jsonapi/tests/src/Functional/UserTest.php
Tests if JSON:API respects user.settings.cancel_method: user_cancel_reassign.

File

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

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.