function AcquiaLiftWebTestTarget::testNestedAgentSettings in Acquia Lift Connector 7.2
File
- tests/
acquia_lift.test, line 2253 - Integration tests for Acquia Lift module.
Class
Code
function testNestedAgentSettings() {
$agent = $this
->createTargetingAgentWithNestedTest();
personalize_agent_set_status($agent->machine_name, PERSONALIZE_STATUS_RUNNING);
$this
->resetAll();
$option_sets = personalize_option_set_load_by_agent($agent->machine_name);
$option_set = reset($option_sets);
$this
->drupalGet('');
$settings = $this
->drupalGetSettings();
$this
->assertTrue(isset($settings['acquia_lift_target']['nested_tests']));
$sub_agent = $agent->machine_name . '-test';
$expected = array(
$agent->machine_name => array(
$sub_agent => $sub_agent,
),
);
$this
->assertEqual($settings['acquia_lift_target']['nested_tests'], $expected);
$this
->assertEqual($settings['acquia_lift']['api_class'], 'acquiaLiftAPI');
$this
->assertEqual($settings['acquia_lift_learn']['baseUrl'], 'http://api.example.com');
// Now let's place our personalized block and confirm that the settings are
// still as they should be.
$admin_user = $this
->drupalCreateUser(array(
'access administration pages',
'manage personalized content',
'administer blocks',
));
$this
->drupalLogin($admin_user);
$edit = array(
'blocks[personalize_blocks_' . $option_set->osid . '][region]' => 'content',
);
$this
->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this
->drupalLogout();
$this
->drupalGet('');
$settings = $this
->drupalGetSettings();
$this
->assertTrue(isset($settings['acquia_lift_target']['nested_tests']));
$sub_agent = $agent->machine_name . '-test';
$expected = array(
$agent->machine_name => array(
$sub_agent => $sub_agent,
),
);
$this
->assertEqual($settings['acquia_lift_target']['nested_tests'], $expected);
$this
->assertEqual($settings['acquia_lift']['api_class'], 'acquiaLiftAPI');
$this
->assertEqual($settings['acquia_lift_learn']['baseUrl'], 'http://api.example.com');
}