function PhpPasswordTest::testLongPassword

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

Verifies that passwords longer than 512 bytes are not hashed.

@covers ::hash

@dataProvider providerLongPasswords

File

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

Class

PhpPasswordTest
Unit tests for password hashing API.

Namespace

Drupal\Tests\Core\Password

Code

public function testLongPassword($password, $allowed) : void {
    $passwordHash = $this->passwordHasher
        ->hash($password);
    if ($allowed) {
        $this->assertNotFalse($passwordHash);
    }
    else {
        $this->assertFalse($passwordHash);
    }
}

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