You are here

public function PasswordLengthTest::lengthDataProvider in Password Policy 8.3

Provides data for the testLength method.

File

password_policy_length/tests/src/Unit/PasswordLengthTest.php, line 34

Class

PasswordLengthTest
Tests the character length constraint.

Namespace

Drupal\Tests\password_policy_length\Unit

Code

public function lengthDataProvider() {
  return [
    // Passing conditions.
    [
      1,
      'minimum',
      'P',
      TRUE,
    ],
    [
      1,
      'maximum',
      'P',
      TRUE,
    ],
    [
      10,
      'minimum',
      '1234567890',
      TRUE,
    ],
    [
      10,
      'maximum',
      'Password',
      TRUE,
    ],
    // Failing conditions.
    [
      1,
      'minimum',
      '',
      FALSE,
    ],
    [
      1,
      'maximum',
      'Pa',
      FALSE,
    ],
    [
      10,
      'minimum',
      'Password',
      FALSE,
    ],
    [
      10,
      'maximum',
      'PasswordPassword',
      FALSE,
    ],
  ];
}