You are here

protected function AsymmetricalEncryptionMethod::setUp in Encrypt 8.3

Overrides KernelTestBase::setUp

File

tests/src/Kernel/AsymmetricalEncryptionMethod.php, line 36

Class

AsymmetricalEncryptionMethod
Tests asymmetrical_encryption_method encryption method.

Namespace

Drupal\Tests\encrypt\Kernel

Code

protected function setUp() {
  parent::setUp();

  // Create a 128bit testkey.
  $key = Key::create([
    'id' => 'testing_key_128',
    'label' => 'Testing Key 128 bit',
    'key_type' => "encryption",
    'key_type_settings' => [
      'key_size' => '128',
    ],
    'key_provider' => 'config',
    'key_provider_settings' => [
      'key_value' => 'mustbesixteenbit',
    ],
  ]);
  $key
    ->save();

  // Create test encryption profiles.
  $this->encryptionProfile = EncryptionProfile::create([
    'id' => 'test_encryption_profile',
    'label' => 'Test Encryption profile',
    'encryption_method' => 'asymmetrical_encryption_method',
    'encryption_key' => $key
      ->id(),
  ]);
  $this->encryptionProfile
    ->save();
}