You are here

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

Creates test keys for usage in tests.

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

File

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

Class

BaseFieldSettingsFormTest
Tests for the machine name field.

Namespace

Drupal\Tests\field_encrypt\FunctionalJavascript

Code

protected function createTestKeys() {

  // Create a 128bit test key.
  $key_128 = 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_128
    ->save();
  $this->testKeys['testing_key_128'] = $key_128;

  // Create a 256bit test key.
  $key_256 = Key::create([
    'id' => 'testing_key_256',
    'label' => 'Testing Key 256 bit',
    'key_type' => "encryption",
    'key_type_settings' => [
      'key_size' => '256',
    ],
    'key_provider' => 'config',
    'key_provider_settings' => [
      'key_value' => 'mustbesixteenbitmustbesixteenbit',
    ],
  ]);
  $key_256
    ->save();
  $this->testKeys['testing_key_256'] = $key_256;
}