protected function doTestLogin($format) { $client = \Drupal::
httpClient();
// Create new user for each iteration to reset flood.
// Grant the user administer users permissions to they can see the
// 'roles' field.
$account =
$this->
drupalCreateUser(['administer users'
]);
$name =
$account->
getAccountName();
$pass =
$account->passRaw;
$login_status_url =
$this->
getLoginStatusUrlString($format);
$response =
$client->
get($login_status_url);
$this->
assertHttpResponse($response, 200, UserAuthenticationController::LOGGED_OUT
);
// Flooded.
$this->
config('user.flood'
) ->
set('user_limit', 3
) ->
save();
$response =
$this->
loginRequest($name, 'wrong-pass',
$format);
$this->
assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.',
$format);
$response =
$this->
loginRequest($name, 'wrong-pass',
$format);
$this->
assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.',
$format);