function RestRegisterUserTest::createRequestOptions

Same name in other branches
  1. 8.9.x core/modules/user/tests/src/Functional/RestRegisterUserTest.php \Drupal\Tests\user\Functional\RestRegisterUserTest::createRequestOptions()

Helper function to generate the request body.

Parameters

array $request_body: The request body array.

Return value

array Return the request options.

1 call to RestRegisterUserTest::createRequestOptions()
RestRegisterUserTest::registerRequest in core/modules/hal/tests/src/Functional/user/RestRegisterUserTest.php
Make a REST user registration request.

File

core/modules/hal/tests/src/Functional/user/RestRegisterUserTest.php, line 188

Class

RestRegisterUserTest
Tests user registration via REST resource.

Namespace

Drupal\Tests\hal\Functional\user

Code

protected function createRequestOptions(array $request_body) {
    $request_options = $this->getAuthenticationRequestOptions('POST');
    $request_options[RequestOptions::BODY] = $this->serializer
        ->encode($request_body, static::$format);
    $request_options[RequestOptions::HEADERS]['Content-Type'] = static::$mimeType;
    return $request_options;
}

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