function AcquiaLiftWebTestVariationSets::testPersonalizeBlockRedirection in Acquia Lift Connector 7
Same name and namespace in other branches
- 7.2 tests/acquia_lift.test \AcquiaLiftWebTestVariationSets::testPersonalizeBlockRedirection()
File
- tests/
acquia_lift.test, line 770 - Integration tests for Acquia Lift module.
Class
Code
function testPersonalizeBlockRedirection() {
// Create a new agent
$agent = $this
->createTestAgent();
// Create a personalized block from the form with a destination in the
// url query string.
$this
->drupalGet('/admin/structure/personalize/variations/personalize-blocks/add', array(
'query' => array(
'destination' => 'node',
),
));
$edit = array(
'agent_select' => $agent
->getMachineName(),
'title' => 'My test block',
'blocks[0][option_label]' => 'Option A',
'blocks[0][block][bid]' => 'comment_delta_recent',
'blocks[1][option_label]' => 'Option B',
'blocks[1][block][bid]' => 'system_delta_main',
);
$this
->drupalPost(NULL, $edit, t('Save'));
// Verify that the user is redirected to the original page with a custom
// URL query parameter.
$this
->assertUrl('node', array(
'query' => array(
'liftpm' => 'new_block|My test block',
),
));
// Verify that the pending message has been added to the settings.
$expected_message = t('Created the new <em class="placeholder">My test block</em> personalized block. The block will not appear on your website until you add the block to a region on the !blocks page.', array(
'!blocks' => l('Structure > Blocks', 'admin/structure/blocks'),
));
$settings = $this
->drupalGetSettings();
$this
->assertEqual($settings['acquia_lift']['pendingMessage'], array(
$expected_message,
));
}