You are here

protected function BaseFieldSettingsFormTest::createTestEncryptionProfiles in Field Encryption 3.0.x

Creates test encryption profiles for usage in tests.

1 call to BaseFieldSettingsFormTest::createTestEncryptionProfiles()
BaseFieldSettingsFormTest::setUp in tests/src/FunctionalJavascript/BaseFieldSettingsFormTest.php

File

tests/src/FunctionalJavascript/BaseFieldSettingsFormTest.php, line 142

Class

BaseFieldSettingsFormTest
Tests for the machine name field.

Namespace

Drupal\Tests\field_encrypt\FunctionalJavascript

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;
}