You are here

function AcquiaLiftWebTestConfig::testPersonalizeElementsConfigurationIntegration in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 tests/acquia_lift.test \AcquiaLiftWebTestConfig::testPersonalizeElementsConfigurationIntegration()

File

tests/acquia_lift.test, line 458
Integration tests for Acquia Lift module.

Class

AcquiaLiftWebTestConfig

Code

function testPersonalizeElementsConfigurationIntegration() {
  $fullAdminUser = $this
    ->drupalCreateUser(array(
    'access administration pages',
    'administer personalize configuration',
    'use advanced personalize elements features',
  ));
  $this
    ->drupalLogin($fullAdminUser);

  // Test edit in context settings added to personalize elements configuration form.
  $this
    ->drupalGet('admin/config/content/personalize/personalize-elements');

  // Should be initially set to 1.
  $this
    ->assertFieldChecked('edit-acquia-lift-html-context-strip');
  $edit = array(
    'acquia_lift_html_context_strip' => FALSE,
  );
  $this
    ->drupalPost(NULL, $edit, $this
    ->getButton('config'));

  // Check the javascript setting.
  $this
    ->drupalLogin($this->managerUser);
  $this
    ->drupalGet('');
  $settings = $this
    ->drupalGetSettings();
  $this
    ->assertEqual($settings['acquia_lift']['edit_in_context_html_strip'], 0);

  // Set it back.
  $this
    ->drupalLogin($fullAdminUser);
  $edit = array(
    'acquia_lift_html_context_strip' => TRUE,
  );
  $this
    ->drupalPost('admin/config/content/personalize/personalize-elements', $edit, $this
    ->getButton('config'));

  // Check that the JavaScript settings changed.
  $this
    ->drupalLogin($this->managerUser);
  $this
    ->drupalGet('');
  $settings = $this
    ->drupalGetSettings();
  $this
    ->assertEqual($settings['acquia_lift']['edit_in_context_html_strip'], 1);
}