function PhpPasswordDefaultIntegrationTest::testDefaultHashing

Tests that the default password hashing algorithm is used.

File

core/tests/Drupal/KernelTests/Core/Password/PhpPasswordDefaultIntegrationTest.php, line 24

Class

PhpPasswordDefaultIntegrationTest
Integration tests for the PHP password hashing service.

Namespace

Drupal\KernelTests\Core\Password

Code

public function testDefaultHashing() : void {
  $password = 'correct horse battery staple';
  $hash = $this->container
    ->get(PasswordInterface::class)
    ->hash($password);
  $this->assertStringStartsWith(implode([
    '$',
    PASSWORD_ARGON2ID,
    '$',
  ]), $hash);
}

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