function UserRegistrationRestTest::registerUser
Same name in other branches
- 9 core/modules/user/tests/src/Functional/UserRegistrationRestTest.php \Drupal\Tests\user\Functional\UserRegistrationRestTest::registerUser()
- 10 core/modules/user/tests/src/Functional/UserRegistrationRestTest.php \Drupal\Tests\user\Functional\UserRegistrationRestTest::registerUser()
Registers a user via REST resource.
Parameters
string $name: User name.
bool $include_password: Include the password.
bool $include_email: Include the email?
Return value
bool|\Drupal\user\Entity\User Return bool or the user.
1 call to UserRegistrationRestTest::registerUser()
- 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 206
Class
- UserRegistrationRestTest
- Tests registration of user using REST.
Namespace
Drupal\Tests\user\FunctionalCode
protected function registerUser($name, $include_password = TRUE, $include_email = TRUE) {
// Verify that an anonymous user can register.
$response = $this->registerRequest($name, $include_password, $include_email);
$this->assertResourceResponse(200, FALSE, $response);
$user = user_load_by_name($name);
$this->assertNotEmpty($user, 'User was create as expected');
return $user;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.