You are here

function TriggerActionTestCase::assignSystemMessageAction in Drupal 7

Assigns a system message action to the passed-in trigger.

Parameters

$trigger: For example, 'user_login'

1 call to TriggerActionTestCase::assignSystemMessageAction()
TriggerUserTokenTestCase::testUserTriggerTokenReplacement in modules/trigger/trigger.test
Tests a variety of token replacements in actions.

File

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

Class

TriggerActionTestCase
Provides a base class with trigger assignments and test comparisons.

Code

function assignSystemMessageAction($trigger) {
  $form_name = "trigger_{$trigger}_assign_form";
  $form_html_id = strtr($form_name, '_', '-');

  // Assign a configurable action 'System message' to the passed trigger.
  $action_edit = array(
    'actions_label' => $trigger . "_system_message_action_" . $this
      ->randomName(16),
    'message' => $this
      ->generateMessageWithTokens($trigger),
  );

  // Configure an advanced action that we can assign.
  $aid = $this
    ->configureAdvancedAction('system_message_action', $action_edit);
  $edit = array(
    'aid' => drupal_hash_base64($aid),
  );
  $this
    ->drupalPost('admin/structure/trigger/user', $edit, t('Assign'), array(), array(), $form_html_id);
  drupal_static_reset('trigger_get_asssigned_actions');
}