function UserPasswordResetTest::assertNoValidPasswordReset

Same name in other branches
  1. 9 core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::assertNoValidPasswordReset()
  2. 10 core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::assertNoValidPasswordReset()
  3. 11.x 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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.