function UserRegistrationRestTest::createRequestBody
Same name in other branches
- 9 core/modules/user/tests/src/Functional/UserRegistrationRestTest.php \Drupal\Tests\user\Functional\UserRegistrationRestTest::createRequestBody()
- 11.x core/modules/user/tests/src/Functional/UserRegistrationRestTest.php \Drupal\Tests\user\Functional\UserRegistrationRestTest::createRequestBody()
Create the request body.
Parameters
string $name: Name.
bool $include_password: Include Password.
bool $include_email: Include Email.
Return value
array Return the request body.
1 call to UserRegistrationRestTest::createRequestBody()
- UserRegistrationRestTest::registerRequest in core/
modules/ user/ tests/ src/ Functional/ UserRegistrationRestTest.php - Make a REST user registration request.
File
-
core/
modules/ user/ tests/ src/ Functional/ UserRegistrationRestTest.php, line 159
Class
- UserRegistrationRestTest
- Tests registration of user using REST.
Namespace
Drupal\Tests\user\FunctionalCode
protected function createRequestBody($name, $include_password = TRUE, $include_email = TRUE) {
$request_body = [
'langcode' => [
[
'value' => 'en',
],
],
'name' => [
[
'value' => $name,
],
],
];
if ($include_email) {
$request_body['mail'] = [
[
'value' => $name . self::USER_EMAIL_DOMAIN,
],
];
}
if ($include_password) {
$request_body['pass']['value'] = 'SuperSecretPassword';
}
return $request_body;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.