TriggerWebTestCase::configureAdvancedAction

7 trigger.test protected TriggerWebTestCase::configureAdvancedAction($action, $edit)

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.

File

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

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();
}
Login or register to post comments