DefaultPasswordGeneratorTest.php

Same filename in other branches
  1. 9 core/tests/Drupal/Tests/Core/Password/DefaultPasswordGeneratorTest.php
  2. 11.x core/tests/Drupal/Tests/Core/Password/DefaultPasswordGeneratorTest.php

Namespace

Drupal\Tests\Core\Password

File

core/tests/Drupal/Tests/Core/Password/DefaultPasswordGeneratorTest.php

View source
<?php

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

use Drupal\Core\Password\DefaultPasswordGenerator;
use Drupal\Tests\UnitTestCase;

/**
 * Unit tests for password generator.
 *
 * @coversDefaultClass \Drupal\Core\Password\DefaultPasswordGenerator
 * @group System
 */
class DefaultPasswordGeneratorTest extends UnitTestCase {
    
    /**
     * @covers ::generate
     */
    public function testGenerate() : void {
        $generator = new DefaultPasswordGenerator();
        $password = $generator->generate();
        $this->assertEquals(10, strlen($password));
        $password = $generator->generate(32);
        $this->assertEquals(32, strlen($password));
    }

}

Classes

Title Deprecated Summary
DefaultPasswordGeneratorTest Unit tests for password generator.

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