You are here

protected function FieldEncryptTestBase::setFieldStorageSettings in Field Encryption 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/FieldEncryptTestBase.php \Drupal\Tests\field_encrypt\Functional\FieldEncryptTestBase::setFieldStorageSettings()

Set up storage settings for test fields.

Parameters

bool $encryption: Whether or not the fields should be encrypted. Defaults to TRUE.

5 calls to FieldEncryptTestBase::setFieldStorageSettings()
ConfigurableFieldTest::testEncryptFieldNormal in tests/src/Functional/ConfigurableFieldTest.php
Test encrypting fields.
ConfigurableFieldTest::testEncryptFieldRevision in tests/src/Functional/ConfigurableFieldTest.php
Test encrypting fields with revisions.
ConfigurableFieldTest::testEncryptFieldTranslation in tests/src/Functional/ConfigurableFieldTest.php
Test encrypting fields with translations.
EncryptingExistingDataTest::testEncryptingExistingData in tests/src/Functional/EncryptingExistingDataTest.php
Tests that existing entities can be encrypted.
FieldEncryptApiHooksTest::testHooks in tests/src/Functional/FieldEncryptApiHooksTest.php
Tests field_encrypt hooks.
1 method overrides FieldEncryptTestBase::setFieldStorageSettings()
CacheTest::setFieldStorageSettings in tests/src/Functional/CacheTest.php
Set up storage settings for test fields.

File

tests/src/Functional/FieldEncryptTestBase.php, line 158

Class

FieldEncryptTestBase
Base test class for field_encrypt.

Namespace

Drupal\Tests\field_encrypt\Functional

Code

protected function setFieldStorageSettings($encryption = TRUE) {

  // Set up storage settings for first field.
  $this
    ->drupalGet('admin/structure/types/manage/page/fields/node.page.field_test_single/storage');

  // Encrypt field found.
  $this
    ->assertSession()
    ->fieldExists('field_encrypt[encrypt]');
  $edit = [
    'field_encrypt[encrypt]' => $encryption,
    'field_encrypt[properties][value]' => 'value',
    'field_encrypt[properties][summary]' => 'summary',
  ];
  $this
    ->submitForm($edit, 'Save field settings');
  $this
    ->assertSession()
    ->pageTextContains('Updated field Single field field settings.');

  // Set up storage settings for second field.
  $this
    ->drupalGet('admin/structure/types/manage/page/fields/node.page.field_test_multi/storage');

  // Encrypt field found.
  $this
    ->assertSession()
    ->fieldExists('field_encrypt[encrypt]');
  $edit = [
    'field_encrypt[encrypt]' => $encryption,
    'field_encrypt[properties][value]' => 'value',
  ];
  $this
    ->submitForm($edit, 'Save field settings');
  $this
    ->assertSession()
    ->pageTextContains('Updated field Multi field field settings.');
  $this
    ->rebuildAll();
}