You are here

protected function BaseFieldTest::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.

4 calls to BaseFieldTest::setFieldStorageSettings()
BaseFieldTest::testEncryptFieldNormal in tests/src/Functional/BaseFieldTest.php
Test encrypting base fields.
BaseFieldTest::testEncryptFieldRevision in tests/src/Functional/BaseFieldTest.php
Test encrypting fields with revisions.
BaseFieldTest::testEncryptFieldTranslation in tests/src/Functional/BaseFieldTest.php
Test encrypting fields with translations.
BaseFieldTest::testEntityTypeDependencies in tests/src/Functional/BaseFieldTest.php
Tests that uninstalling a module providing an entity type works.

File

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

Class

BaseFieldTest
Tests base field encryption.

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();
}