You are here

protected function EntityHooksTest::setFieldStorageSettings 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 EntityHooksTest::setFieldStorageSettings()
EntityHooksTest::testStatusReport in tests/src/Functional/EntityHooksTest.php
Tests field_encrypt prints code on status report when eval() disabled.

File

tests/src/Functional/EntityHooksTest.php, line 71

Class

EntityHooksTest
Tests Field encrypt's use_eval_for_entity_hooks setting.

Namespace

Drupal\Tests\field_encrypt\Functional

Code

protected function setFieldStorageSettings($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();
}