protected function UserResourceTestBase::assertRpcLogin in Drupal 9
Same name and namespace in other branches
- 8 core/modules/user/tests/src/Functional/Rest/UserResourceTestBase.php \Drupal\Tests\user\Functional\Rest\UserResourceTestBase::assertRpcLogin()
Verifies that logging in with the given username and password works.
Parameters
string $username: The username to log in with.
string $password: The password to log in with.
1 call to UserResourceTestBase::assertRpcLogin()
- UserResourceTestBase::testPatchDxForSecuritySensitiveBaseFields in core/
modules/ user/ tests/ src/ Functional/ Rest/ UserResourceTestBase.php - Tests PATCHing security-sensitive base fields of the logged in account.
File
- core/
modules/ user/ tests/ src/ Functional/ Rest/ UserResourceTestBase.php, line 248
Class
Namespace
Drupal\Tests\user\Functional\RestCode
protected function assertRpcLogin($username, $password) {
$request_body = [
'name' => $username,
'pass' => $password,
];
$request_options = [
RequestOptions::HEADERS => [],
RequestOptions::BODY => $this->serializer
->encode($request_body, 'json'),
];
$response = $this
->request('POST', Url::fromRoute('user.login.http')
->setRouteParameter('_format', 'json'), $request_options);
$this
->assertSame(200, $response
->getStatusCode());
}