function PasswordHashingTest::testWithinBounds

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php \Drupal\Tests\Core\Password\PasswordHashingTest::testWithinBounds()

Tests the hash count boundaries are enforced.

@covers ::enforceLog2Boundaries

File

core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php, line 73

Class

PasswordHashingTest
Unit tests for password hashing API.

Namespace

Drupal\Tests\Core\Password

Code

public function testWithinBounds() {
    $hasher = new FakePhpassHashedPassword();
    $this->assertEquals(PhpassHashedPassword::MIN_HASH_COUNT, $hasher->enforceLog2Boundaries(1), "Min hash count enforced");
    $this->assertEquals(PhpassHashedPassword::MAX_HASH_COUNT, $hasher->enforceLog2Boundaries(100), "Max hash count enforced");
}

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