You are here

protected function EncryptTestBase::createTestEncryptionProfiles in Encrypt 8.3

Creates test encryption profiles for usage in tests.

1 call to EncryptTestBase::createTestEncryptionProfiles()
EncryptTestBase::setUp in tests/src/Functional/EncryptTestBase.php

File

tests/src/Functional/EncryptTestBase.php, line 95

Class

EncryptTestBase
Defines a base class for tests.

Namespace

Drupal\Tests\encrypt\Functional

Code

protected function createTestEncryptionProfiles() {

  // Create test encryption profiles.
  $encryption_profile_1 = EncryptionProfile::create([
    'id' => 'encryption_profile_1',
    'label' => 'Encryption profile 1',
    'encryption_method' => 'test_encryption_method',
    'encryption_key' => $this->testKeys['testing_key_128']
      ->id(),
  ]);
  $encryption_profile_1
    ->save();
  $this->encryptionProfiles['encryption_profile_1'] = $encryption_profile_1;
  $encryption_profile_2 = EncryptionProfile::create([
    'id' => 'encryption_profile_2',
    'label' => 'Encryption profile 2',
    'encryption_method' => 'config_test_encryption_method',
    'encryption_method_configuration' => [
      'mode' => 'CFB',
    ],
    'encryption_key' => $this->testKeys['testing_key_256']
      ->id(),
  ]);
  $encryption_profile_2
    ->save();
  $this->encryptionProfiles['encryption_profile_2'] = $encryption_profile_2;
}