function RestRegisterUserTest::registerRequest

Same name in other branches
  1. 9 core/modules/hal/tests/src/Functional/user/RestRegisterUserTest.php \Drupal\Tests\hal\Functional\user\RestRegisterUserTest::registerRequest()

Make a REST user registration request.

Parameters

string $name: The name.

bool $include_password: Include the password?

bool $include_email: Include the email?

Return value

\Psr\Http\Message\ResponseInterface Return the Response.

2 calls to RestRegisterUserTest::registerRequest()
RestRegisterUserTest::registerUser in core/modules/user/tests/src/Functional/RestRegisterUserTest.php
Registers a user via REST resource.
RestRegisterUserTest::testRegisterUser in core/modules/user/tests/src/Functional/RestRegisterUserTest.php
Tests that only anonymous users can register users.

File

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

Class

RestRegisterUserTest
Tests user registration via REST resource.

Namespace

Drupal\Tests\user\Functional

Code

protected function registerRequest($name, $include_password = TRUE, $include_email = TRUE) {
    $user_register_url = Url::fromRoute('user.register')->setRouteParameter('_format', static::$format);
    $request_body = $this->createRequestBody($name, $include_password, $include_email);
    $request_options = $this->createRequestOptions($request_body);
    $response = $this->request('POST', $user_register_url, $request_options);
    return $response;
}

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