You are here

protected function EntityHooksTest::setUp in Field Encryption 3.0.x

@TODO: Simplify setUp() by extending EncryptTestBase when https://www.drupal.org/node/2692387 lands.

File

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

Class

EntityHooksTest
Tests Field encrypt's use_eval_for_entity_hooks setting.

Namespace

Drupal\Tests\field_encrypt\Functional

Code

protected function setUp() {
  parent::setUp();

  // Disable eval().
  $settings['settings']['field_encrypt.use_eval_for_entity_hooks'] = (object) [
    'value' => FALSE,
    'required' => TRUE,
  ];
  $this
    ->writeSettings($settings);

  // Create an admin user.
  $this->adminUser = $this
    ->drupalCreateUser([
    'access administration pages',
    'administer encrypt',
    'administer keys',
    'administer field encryption',
  ], NULL, TRUE);
  $this
    ->drupalLogin($this->adminUser);

  // Create content type to test.
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);
  $this
    ->config('field_encrypt.settings')
    ->set('encryption_profile', 'encryption_profile_1')
    ->save();
}