You are here

function TokenActionsTestCase::createAction in Token 6

Create an action.

Parameters

$action: The machine name of the action.

$edit: An optional array to pass onto drupalPost() for configuring the action.

Return value

The created action object.

1 call to TokenActionsTestCase::createAction()
TokenActionsTestCase::testUserActions in ./token_actions.test
Test user actions and triggers.

File

./token_actions.test, line 55
Tests for the token_actions module.

Class

TokenActionsTestCase
@file Tests for the token_actions module.

Code

function createAction($action, $edit = array()) {
  $edit += array(
    'actions_description' => $this
      ->randomName(),
  );
  $this
    ->drupalPost('admin/settings/actions/configure/' . md5($action), $edit, t('Save'));
  $this
    ->assertText('The action has been successfully saved.');
  return db_fetch_object(db_query("SELECT * FROM {actions} WHERE type = 'system' AND callback = '%s' AND description = '%s'", $action, $edit['actions_description']));
}