You are here

protected function TriggerWebTestCase::configureAdvancedAction in Drupal 7

Configures an advanced action.

Parameters

$action: The name of the action callback. For example: 'user_block_user_action'

$edit: The $edit array for the form to be used to configure. Example members would be 'actions_label' (always), 'message', etc.

Return value

the aid (action id) of the configured action, or FALSE if none.

4 calls to TriggerWebTestCase::configureAdvancedAction()
TriggerActionTestCase::assignSystemEmailAction in modules/trigger/trigger.test
Assigns a system_send_email_action to the passed-in trigger.
TriggerActionTestCase::assignSystemMessageAction in modules/trigger/trigger.test
Assigns a system message action to the passed-in trigger.
TriggerCronTestCase::testActionsCron in modules/trigger/trigger.test
Tests assigning multiple actions to the cron trigger.
TriggerOtherTestCase::testActionsUser in modules/trigger/trigger.test
Tests triggering on user create and user login.

File

modules/trigger/trigger.test, line 25
Tests for trigger.module.

Class

TriggerWebTestCase
Provides common helper methods.

Code

protected function configureAdvancedAction($action, $edit) {

  // Create an advanced action.
  $hash = drupal_hash_base64($action);
  $this
    ->drupalPost("admin/config/system/actions/configure/{$hash}", $edit, t('Save'));
  $this
    ->assertText(t('The action has been successfully saved.'));

  // Now we have to find out the action ID of what we created.
  return db_query('SELECT aid FROM {actions} WHERE callback = :callback AND label = :label', array(
    ':callback' => $action,
    ':label' => $edit['actions_label'],
  ))
    ->fetchField();
}