You are here

public function EncryptionProfileTest::validateDataProvider in Encrypt 8.3

Data provider for validate() function.

File

tests/src/Unit/Entity/EncryptionProfileTest.php, line 162

Class

EncryptionProfileTest
Unit tests for EncryptionProfile class.

Namespace

Drupal\Tests\encrypt\Unit\Entity

Code

public function validateDataProvider() {
  $valid_definition = [
    'id' => 'test_encryption_method',
    'title' => "Test encryption method",
    'key_type' => [
      'encryption',
    ],
  ];
  $invalid_allowed_keytypes = $valid_definition;
  $invalid_allowed_keytypes['key_type'] = [
    'other_encryption',
  ];
  return [
    'invalid_properties' => [
      NULL,
      NULL,
      NULL,
      [
        'No encryption method selected.',
        'No encryption key selected.',
      ],
    ],
    'invalid_encryption_method' => [
      'invalid_encryption_method',
      'test_key',
      NULL,
      [
        'The encryption method linked to this encryption profile does not exist.',
      ],
    ],
    'invalid_key' => [
      'test_encryption_method',
      'wrong_key',
      $valid_definition,
      [
        'The key linked to this encryption profile does not exist.',
      ],
    ],
    'invalid_keytypes' => [
      'test_encryption_method',
      'test_key',
      $invalid_allowed_keytypes,
      [
        'The selected key cannot be used with the selected encryption method.',
      ],
    ],
    'normal' => [
      'test_encryption_method',
      'test_key',
      $valid_definition,
      [],
    ],
  ];
}