You are here

protected function FieldEncryptApiHooksTest::setBaseFieldStorageSettings in Field Encryption 3.0.x

Set up base fields for test.

Parameters

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

1 call to FieldEncryptApiHooksTest::setBaseFieldStorageSettings()
FieldEncryptApiHooksTest::testHooks in tests/src/Functional/FieldEncryptApiHooksTest.php
Tests field_encrypt hooks.

File

tests/src/Functional/FieldEncryptApiHooksTest.php, line 42

Class

FieldEncryptApiHooksTest
Tests Field Encrypt's API hooks.

Namespace

Drupal\Tests\field_encrypt\Functional

Code

protected function setBaseFieldStorageSettings($encryption = TRUE) {

  // Set up storage settings for first field.
  $this
    ->drupalGet('admin/config/system/field-encrypt/entity-types');
  $this
    ->assertSession()
    ->fieldExists('entity_type')
    ->selectOption('Content');
  $this
    ->submitForm([], 'Save configuration');
  if ($encryption) {
    $this
      ->assertSession()
      ->fieldExists('base_fields[title]')
      ->check();
  }
  else {
    $this
      ->assertSession()
      ->fieldExists('base_fields[title]')
      ->uncheck();
  }
  $this
    ->submitForm([], 'Save configuration');
  $this
    ->assertSession()
    ->pageTextContains('Updated encryption settings for Content base fields.');
  $this
    ->rebuildAll();
}