function UserRegistrationRestTest::registerRequest
Same name in other branches
- 9 core/modules/user/tests/src/Functional/UserRegistrationRestTest.php \Drupal\Tests\user\Functional\UserRegistrationRestTest::registerRequest()
- 10 core/modules/user/tests/src/Functional/UserRegistrationRestTest.php \Drupal\Tests\user\Functional\UserRegistrationRestTest::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 UserRegistrationRestTest::registerRequest()
- UserRegistrationRestTest::registerUser in core/
modules/ user/ tests/ src/ Functional/ UserRegistrationRestTest.php - Registers a user via REST resource.
- UserRegistrationRestTest::testRegisterUser in core/
modules/ user/ tests/ src/ Functional/ UserRegistrationRestTest.php - Tests that only anonymous users can register users.
File
-
core/
modules/ user/ tests/ src/ Functional/ UserRegistrationRestTest.php, line 229
Class
- UserRegistrationRestTest
- Tests registration of user using REST.
Namespace
Drupal\Tests\user\FunctionalCode
protected function registerRequest($name, $include_password = TRUE, $include_email = TRUE) : ResponseInterface {
$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.