protected function EncryptTestBase::createTestKeys in Encrypt 8.3
Creates test keys for usage in tests.
1 call to EncryptTestBase::createTestKeys()
- EncryptTestBase::setUp in tests/
src/ Functional/ EncryptTestBase.php
File
- tests/
src/ Functional/ EncryptTestBase.php, line 66
Class
- EncryptTestBase
- Defines a base class for tests.
Namespace
Drupal\Tests\encrypt\FunctionalCode
protected function createTestKeys() {
// Create a 128bit testkey.
$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 testkey.
$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;
}