PhpPasswordDefaultIntegrationTest.php

Namespace

Drupal\KernelTests\Core\Password

File

core/tests/Drupal/KernelTests/Core/Password/PhpPasswordDefaultIntegrationTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\KernelTests\Core\Password;

use Drupal\Core\Password\PasswordInterface;
use Drupal\Core\Password\PhpPassword;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;

/**
 * Integration tests for the PHP password hashing service.
 */
class PhpPasswordDefaultIntegrationTest extends PasswordTestBase {
  
  /**
   * Tests that the default password hashing algorithm is used.
   */
  public function testDefaultHashing() : void {
    $password = 'correct horse battery staple';
    $hash = $this->container
      ->get(PasswordInterface::class)
      ->hash($password);
    $this->assertStringStartsWith(implode([
      '$',
      PASSWORD_ARGON2ID,
      '$',
    ]), $hash);
  }

}

Classes

Title Deprecated Summary
PhpPasswordDefaultIntegrationTest Integration tests for the PHP password hashing service.

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