You are here

public function UserPasswordResetTest::assertNoValidPasswordReset in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::assertNoValidPasswordReset()

Helper function to make assertions about an invalid password reset.

2 calls to UserPasswordResetTest::assertNoValidPasswordReset()
UserPasswordResetTest::testUserPasswordReset in core/modules/user/tests/src/Functional/UserPasswordResetTest.php
Tests password reset functionality.
UserPasswordResetTest::testUserResetPasswordIpFloodControl in core/modules/user/tests/src/Functional/UserPasswordResetTest.php
Tests password reset flood control for one IP.

File

core/modules/user/tests/src/Functional/UserPasswordResetTest.php, line 387

Class

UserPasswordResetTest
Ensure that password reset methods work as expected.

Namespace

Drupal\Tests\user\Functional

Code

public function assertNoValidPasswordReset($name) {

  // Make sure the error text is displayed and no email sent.
  $this
    ->assertText(t('@name is not recognized as a username or an email address.', [
    '@name' => $name,
  ]), 'Validation error message shown when trying to request password for invalid account.');
  $this
    ->assertCount(0, $this
    ->drupalGetMails([
    'id' => 'user_password_reset',
  ]), 'No e-mail was sent when requesting a password for an invalid account.');
}