You are here

function AcquiaLiftsWebTest::testIdentityParams in Acquia Lift Connector 7.3

Tests identity param configuration and js settings.

File

tests/acquia_lift.test, line 359
Tests for Acquia Lift Profiles module.

Class

AcquiaLiftsWebTest
Tests Acquia Lift functionality.

Code

function testIdentityParams() {
  $submit_button_text = $this->admin_button_text;
  $this
    ->configureLift();
  $this
    ->drupalLogin($this->admin_user);

  // Test specifying a querystring param to use for capturing identity.
  $this
    ->drupalPost('/admin/config/services/acquia_lift', array(
    'acquia_lift_identity_param' => 'ali',
  ), $submit_button_text);
  $this
    ->drupalLogout();

  // Now visit the site as anon without passing any querystring params.
  $this
    ->drupalGet('');
  $this
    ->assertNoLiftIdentityMetaTag();

  // Now pass the configured identity param
  $my_id = 'ohai';
  $this
    ->drupalGet('', array(
    'query' => array(
      'ali' => $my_id,
    ),
  ));
  $this
    ->assertLiftIdentityMetaTag(ACQUIA_LIFT_DEFAULT_IDENTITY_TYPE_DEFAULT, $my_id);

  // Set the identity type param
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalPost('admin/config/services/acquia_lift', array(
    'acquia_lift_identity_type_param' => 'alit',
  ), $submit_button_text);
  $this
    ->drupalLogout();

  // Pass the configured identity param and the identity_type param
  $my_type = 'socialtastic';
  $this
    ->drupalGet('', array(
    'query' => array(
      'ali' => $my_id,
      'alit' => $my_type,
    ),
  ));
  $this
    ->assertLiftIdentityMetaTag($my_type, $my_id);

  // Pass the configured identity type param without the identity param
  $this
    ->drupalGet('', array(
    'query' => array(
      'alit' => $my_type,
    ),
  ));
  $this
    ->assertNoLiftIdentityMetaTag();

  // Set the default identity type
  $default_type = 'tknr';
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalPost('admin/config/services/acquia_lift', array(
    'acquia_lift_default_identity_type' => $default_type,
  ), $submit_button_text);
  $this
    ->drupalLogout();

  // Pass the configured identity param but without the identity_type param
  $this
    ->drupalGet('', array(
    'query' => array(
      'ali' => $my_id,
    ),
  ));
  $this
    ->assertLiftIdentityMetaTag($default_type, $my_id);

  // Pass the configured identity param and with the identity_type param
  $this
    ->drupalGet('', array(
    'query' => array(
      'ali' => $my_id,
      'alit' => $my_type,
    ),
  ));
  $this
    ->assertLiftIdentityMetaTag($my_type, $my_id);
}