You are here

public function EntityHooksTest::testStatusReport in Field Encryption 3.0.x

Tests field_encrypt prints code on status report when eval() disabled.

File

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

Class

EntityHooksTest
Tests Field encrypt's use_eval_for_entity_hooks setting.

Namespace

Drupal\Tests\field_encrypt\Functional

Code

public function testStatusReport() {
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertSession()
    ->pageTextNotContains('Field Encrypt entity hooks');
  $this
    ->setFieldStorageSettings(TRUE);
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertSession()
    ->pageTextContains('Field Encrypt entity hooks');
  $this
    ->assertSession()
    ->pageTextContains('function field_encrypt_node_insert(');
  $this
    ->assertSession()
    ->pageTextContains('function field_encrypt_node_update(');

  // Enable eval().
  $settings['settings']['field_encrypt.use_eval_for_entity_hooks'] = (object) [
    'value' => TRUE,
    'required' => TRUE,
  ];
  $this
    ->writeSettings($settings);
  $this
    ->rebuildAll();
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertSession()
    ->pageTextNotContains('Field Encrypt entity hooks');
}