function AcquiaLiftWebTestCampaignWizardVariations::testWhatFieldsForm in Acquia Lift Connector 7.2
Test the personalize fields view of the "What" campaign subform.
File
- tests/
acquia_lift.test, line 3403 - Integration tests for Acquia Lift module.
Class
Code
function testWhatFieldsForm() {
module_enable(array(
'personalize_fields',
));
$this
->resetAll();
$admin_user = $this
->drupalCreateUser(array(
'access administration pages',
'administer site configuration',
'access content',
'administer content types',
'administer nodes',
'bypass node access',
'manage personalized content',
));
$this
->drupalLogin($admin_user);
// Add personalizable field to the article node type.
$this
->createPersonalizedArticleField();
list($node, $os, $agent_name) = $this
->createPersonalizedField();
$this
->drupalGet("admin/structure/personalize/manage/{$agent_name}/variations");
// Text should be shown in preview.
$this
->assertText('first value');
$this
->assertText('second value');
// Basic variation editing should be available.
$edit = array(
'variations[editing][option_sets][option_set_' . $os->osid . '][content][label]' => 'Fields test edit',
'variations[editing][option_sets][option_set_' . $os->osid . '][content][options][first-value][option_label]' => 'Option A - EDIT',
'variations[editing][option_sets][option_set_' . $os->osid . '][content][options][second-value][option_label]' => 'Option B - EDIT',
'variations[editing][option_sets][option_set_' . $os->osid . '][advanced][preview_link]' => 'node/' . $node->nid,
);
$this
->drupalPost(NULL, $edit, $this
->getButton('wizard_next', array(
'agent_name' => $agent_name,
'step' => 'variations',
)));
// Go back and verify the changes.
$this
->drupalGet("admin/structure/personalize/manage/{$agent_name}/variations");
$this
->assertFieldByName('variations[editing][option_sets][option_set_' . $os->osid . '][content][label]', 'Fields test edit');
$this
->assertFieldByName('variations[editing][option_sets][option_set_' . $os->osid . '][content][options][first-value][option_label]', 'Option A - EDIT');
$this
->assertFieldByName('variations[editing][option_sets][option_set_' . $os->osid . '][content][options][second-value][option_label]', 'Option B - EDIT');
$this
->assertText('first value');
$this
->assertText('second value');
$this
->assertLinkByHref(url('node/' . $node->nid, array(
'query' => array(
PERSONALIZE_PRESELECTION_PARAM => personalize_stringify_osid($os->osid) . '--first-value',
),
)));
$this
->assertLinkByHref(url('node/' . $node->nid, array(
'query' => array(
PERSONALIZE_PRESELECTION_PARAM => personalize_stringify_osid($os->osid) . '--second-value',
),
)));
// Check the link to edit in context.
$this
->clickLink(t('Edit variations in context'));
$this
->assertUrl('node/' . $node->nid . '/edit', array(
'query' => array(
'destination' => "admin/structure/personalize/manage/{$agent_name}/variations",
),
));
$this
->drupalPost(NULL, array(), t('Save'));
$this
->assertUrl("admin/structure/personalize/manage/{$agent_name}/variations");
}