assertValidPasswordReset example

    // This should pass validation and print the generic message.     $this->drupalGet('user/password');
    $long_name = $this->randomMachineName(UserInterface::USERNAME_MAX_LENGTH) . '@example.com';
    $edit = ['name' => $long_name];
    $this->submitForm($edit, 'Submit');
    $this->assertNoValidPasswordReset($long_name);

    // Reset the password by username via the password reset page.     $this->drupalGet('user/password');
    $edit = ['name' => $this->account->getAccountName()];
    $this->submitForm($edit, 'Submit');
    $this->assertValidPasswordReset($edit['name']);

    $resetURL = $this->getResetURL();
    $this->drupalGet($resetURL);
    // Ensure that the current URL does not contain the hash and timestamp.     $this->assertSession()->addressEquals(Url::fromRoute('user.reset.form', ['uid' => $this->account->id()]));

    $this->assertSession()->responseHeaderDoesNotExist('X-Drupal-Cache');

    // Ensure the password reset URL is not cached.     $this->drupalGet($resetURL);
    $this->assertSession()->responseHeaderDoesNotExist('X-Drupal-Cache');

    
Home | Imprint | This part of the site doesn't use cookies.