function PhpPasswordTest::testPasswordChecking

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Core/Password/PhpPasswordTest.php \Drupal\Tests\Core\Password\PhpPasswordTest::testPasswordChecking()

Tests password hashing.

@covers ::check @covers ::needsRehash

File

core/tests/Drupal/Tests/Core/Password/PhpPasswordTest.php, line 61

Class

PhpPasswordTest
Unit tests for password hashing API.

Namespace

Drupal\Tests\Core\Password

Code

public function testPasswordChecking() : void {
    $this->assertTrue($this->passwordHasher
        ->check($this->password, $this->passwordHash), 'Password check succeeds.');
    $this->assertFalse($this->passwordHasher
        ->needsRehash($this->passwordHash), 'Does not need a new hash.');
}

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