diff --git a/core/modules/user/src/Tests/UserLoginTest.php b/core/modules/user/src/Tests/UserLoginTest.php index 4bb663f..ab7e3fc 100644 --- a/core/modules/user/src/Tests/UserLoginTest.php +++ b/core/modules/user/src/Tests/UserLoginTest.php @@ -65,21 +65,22 @@ function testGlobalLoginFloodControl() { $this->assertFailedLogin($user1, 'ip'); $this->resetUserPassword($user1); $this->drupalLogout(); + // Try to login as user 1, it should be successful. $this->drupalLogin($user1); - $this->assertNoRaw(strtr('Too many failed login attempts from your IP address. This IP address is temporarily blocked. Try again later or request a new password.', [ - ':url' => \Drupal::url('user.pass'), - ])); + $this->assertNoRaw('Too many failed login attempts from your IP address.'); } /** * Test the per-user login flood control. */ function testPerUserLoginFloodControl() { + $user_limit = 3; + $this->config('user.flood') // Set a high global limit out so that it is not relevant in the test. ->set('ip_limit', 4000) - ->set('user_limit', 3) + ->set('user_limit', $user_limit) ->save(); $user1 = $this->drupalCreateUser(array()); @@ -115,10 +116,7 @@ function testPerUserLoginFloodControl() { // Try to login as user 1, it should be successful. $this->drupalLogin($user1); - $this->assertNoRaw(strtr('There have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or request a new password.', [ - '@count' => $this->config('user.flood')->get('user_limit'), - ':url' => \Drupal::url('user.pass') - ])); + $this->assertNoRaw('There have been more than ' . $user_limit . ' failed login attempts for this account.'); } /** @@ -179,16 +177,11 @@ function assertFailedLogin($account, $flood_trigger = NULL) { $this->assertNoFieldByXPath("//input[@name='pass' and @value!='']", NULL, 'Password value attribute is blank.'); if (isset($flood_trigger)) { if ($flood_trigger == 'user') { - $this->assertRaw(strtr('There have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or request a new password.', [ - '@count' => $this->config('user.flood')->get('user_limit'), - ':url' => \Drupal::url('user.pass'), - ])); + $this->assertRaw('There have been more than ' . $this->config('user.flood')->get('user_limit') . ' failed login attempts for this account.'); } else { // No uid, so the limit is IP-based. - $this->assertRaw(strtr('Too many failed login attempts from your IP address. This IP address is temporarily blocked. Try again later or request a new password.', [ - ':url' => \Drupal::url('user.pass'), - ])); + $this->assertRaw('Too many failed login attempts from your IP address. This IP address is temporarily blocked.'); } } else {