From be6d3c8bb601fa53839b6c187b31e883e3334560 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sat, 27 Mar 2010 18:32:06 +0000 Subject: #601398 follow-up by andypost, rfay, and sun: Allow drupLPost to target specific form HTML ID for multiple similar forms. --- modules/trigger/trigger.test | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'modules/trigger') diff --git a/modules/trigger/trigger.test b/modules/trigger/trigger.test index ca56ad85f..fed28c997 100644 --- a/modules/trigger/trigger.test +++ b/modules/trigger/trigger.test @@ -55,18 +55,18 @@ class TriggerContentTestCase extends TriggerWebTestCase { global $user; $content_actions = array('node_publish_action', 'node_unpublish_action', 'node_make_sticky_action', 'node_make_unsticky_action', 'node_promote_action', 'node_unpromote_action'); + $test_user = $this->drupalCreateUser(array('administer actions')); + $web_user = $this->drupalCreateUser(array('create page content', 'access content', 'administer nodes')); foreach ($content_actions as $action) { $hash = md5($action); $info = $this->actionInfo($action); // Assign an action to a trigger, then pull the trigger, and make sure // the actions fire. - $test_user = $this->drupalCreateUser(array('administer actions')); $this->drupalLogin($test_user); $edit = array('aid' => $hash); - $this->drupalPost('admin/structure/trigger/node', $edit, t('Assign')); + $this->drupalPost('admin/structure/trigger/node', $edit, t('Assign'), array(), array(), 'trigger-node-presave-assign-form'); // Create an unpublished node. - $web_user = $this->drupalCreateUser(array('create page content', 'access content', 'administer nodes')); $this->drupalLogin($web_user); $edit = array(); $langcode = LANGUAGE_NONE; @@ -83,12 +83,10 @@ class TriggerContentTestCase extends TriggerWebTestCase { // There should be an error when the action is assigned to the trigger // twice. - $test_user = $this->drupalCreateUser(array('administer actions')); $this->drupalLogin($test_user); + // This action already assigned in this test. $edit = array('aid' => $hash); - $this->drupalPost('admin/structure/trigger/node', $edit, t('Assign')); - $edit = array('aid' => $hash); - $this->drupalPost('admin/structure/trigger/node', $edit, t('Assign')); + $this->drupalPost('admin/structure/trigger/node', $edit, t('Assign'), array(), array(), 'trigger-node-presave-assign-form'); $this->assertRaw(t('The action you chose is already assigned to that trigger.'), t('Check to make sure an error occurs when assigning an action to a trigger twice.')); // The action should be able to be unassigned from a trigger. @@ -202,7 +200,7 @@ class TriggerCronTestCase extends TriggerWebTestCase { // Assign a non-configurable action to the cron run trigger. $edit = array('aid' => md5('trigger_test_system_cron_action')); - $this->drupalPost('admin/structure/trigger/system', $edit, t('Assign')); + $this->drupalPost('admin/structure/trigger/system', $edit, t('Assign'), array(), array(), 'trigger-cron-assign-form'); // Assign a configurable action to the cron trigger. $action_label = $this->randomName(); @@ -214,7 +212,7 @@ class TriggerCronTestCase extends TriggerWebTestCase { // $aid is likely 3 but if we add more uses for the sequences table in // core it might break, so it is easier to get the value from the database. $edit = array('aid' => md5($aid)); - $this->drupalPost('admin/structure/trigger/system', $edit, t('Assign')); + $this->drupalPost('admin/structure/trigger/system', $edit, t('Assign'), array(), array(), 'trigger-cron-assign-form'); // Add a second configurable action to the cron trigger. $action_label = $this->randomName(); @@ -224,7 +222,7 @@ class TriggerCronTestCase extends TriggerWebTestCase { ); $aid = $this->configureAdvancedAction('trigger_test_system_cron_conf_action', $edit); $edit = array('aid' => md5($aid)); - $this->drupalPost('admin/structure/trigger/system', $edit, t('Assign')); + $this->drupalPost('admin/structure/trigger/system', $edit, t('Assign'), array(), array(), 'trigger-cron-assign-form'); // Force a cron run. $this->cronRun(); @@ -268,7 +266,7 @@ class TriggerOtherTestCase extends TriggerWebTestCase { $action_id = 'trigger_test_generic_action'; $hash = md5($action_id); $edit = array('aid' => $hash); - $this->drupalPost('admin/structure/trigger/user', $edit, t('Assign')); + $this->drupalPost('admin/structure/trigger/user', $edit, t('Assign'), array(), array(), 'trigger-user-insert-assign-form'); // Set action variable to FALSE. variable_set( $action_id, FALSE ); @@ -302,7 +300,7 @@ class TriggerOtherTestCase extends TriggerWebTestCase { // Configure an advanced action that we can assign. $aid = $this->configureAdvancedAction('system_message_action', $action_edit); $edit = array('aid' => md5($aid)); - $this->drupalPost('admin/structure/trigger/user', $edit, t('Assign'), array(), array(), 'trigger_user_login_assign_form'); + $this->drupalPost('admin/structure/trigger/user', $edit, t('Assign'), array(), array(), 'trigger-user-login-assign-form'); // Verify that the action has been assigned to the correct hook. $actions = trigger_get_assigned_actions('user_login'); @@ -325,7 +323,7 @@ class TriggerOtherTestCase extends TriggerWebTestCase { $action_id = 'trigger_test_generic_action'; $hash = md5($action_id); $edit = array('aid' => $hash); - $this->drupalPost('admin/structure/trigger/comment', $edit, t('Assign')); + $this->drupalPost('admin/structure/trigger/comment', $edit, t('Assign'), array(), array(), 'trigger-comment-insert-assign-form'); // Set action variable to FALSE. variable_set($action_id, FALSE); @@ -354,7 +352,7 @@ class TriggerOtherTestCase extends TriggerWebTestCase { $action_id = 'trigger_test_generic_action'; $hash = md5($action_id); $edit = array('aid' => $hash); - $this->drupalPost('admin/structure/trigger/taxonomy', $edit, t('Assign')); + $this->drupalPost('admin/structure/trigger/taxonomy', $edit, t('Assign'), array(), array(), 'trigger-taxonomy-term-insert-assign-form'); // Set action variable to FALSE. variable_set($action_id, FALSE); @@ -411,7 +409,7 @@ class TriggerOrphanedActionsTestCase extends DrupalWebTestCase { $test_user = $this->drupalCreateUser(array('administer actions')); $this->drupalLogin($test_user); $edit = array('aid' => $hash); - $this->drupalPost('admin/structure/trigger/node', $edit, t('Assign')); + $this->drupalPost('admin/structure/trigger/node', $edit, t('Assign'), array(), array(), 'trigger-node-presave-assign-form'); // Create an unpublished node. $web_user = $this->drupalCreateUser(array('create page content', 'edit own page content', 'access content', 'administer nodes')); -- cgit v1.2.3