You are here

public function PasswordHashingTest::testWithinBounds in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php \Drupal\Tests\Core\Password\PasswordHashingTest::testWithinBounds()
  2. 9 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
Contains \Drupal\Tests\Core\Password\PasswordHashingTest.

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");
}