function ALProfilesWebTest::testBasicConfig in Acquia Lift Connector 7
File
- acquia_lift_profiles/
tests/ acquia_lift_profiles.test, line 31 - Tests for Acquia Lift Profiles module.
Class
- ALProfilesWebTest
- Tests Acquia Lift Profiles functionality.
Code
function testBasicConfig() {
$this
->drupalLogin($this->admin_user);
// Verify that the Acquia Lift Web Admin link is the default.
$this
->assertAcquiaLiftWebAdminLink('http://lift.acquia.com');
$edit = array(
'acquia_lift_profiles_account_name' => 'MYALPROFILESACCOUNT',
'acquia_lift_profiles_site_name' => 'MYALPROFILESSITE',
'acquia_lift_profiles_api_url' => 'api.example.com',
'acquia_lift_profiles_access_key' => 'abc123',
'acquia_lift_profiles_secret_key' => 'xyz987',
'acquia_lift_profiles_js_path' => 'acquia_lift_profiles.example.com/path/to.js',
);
$this
->drupalPost('admin/config/content/personalize/acquia_lift_profiles', $edit, t('Save'));
// Since this is not a system_settings_form we need to assert that the
// variables do in fact get set.
foreach (array(
'acquia_lift_profiles_account_name',
'acquia_lift_profiles_site_name',
'acquia_lift_profiles_api_url',
'acquia_lift_profiles_access_key',
'acquia_lift_profiles_secret_key',
'acquia_lift_profiles_js_path',
) as $key) {
$variable = variable_get($key);
$this
->assertEqual($edit[$key], $variable);
}
// Now verify that protocols are stripped from configuration URLs.
$edit['acquia_lift_profiles_api_url'] = 'http://api.example.com';
$edit['acquia_lift_profiles_js_path'] = 'https://acquia_lift_profiles.example.com/path/to.js';
$this
->drupalPost('admin/config/content/personalize/acquia_lift_profiles', $edit, t('Save'));
$this
->assertEqual(variable_get('acquia_lift_profiles_api_url', ''), 'api.example.com');
$this
->assertEqual(variable_get('acquia_lift_profiles_js_path', ''), 'acquia_lift_profiles.example.com/path/to.js');
// Assert that the web admin link was also updated.
$this
->assertAcquiaLiftWebAdminLink('http://api.example.com');
}