You are here

function TriggerActionTestCase::assignSystemEmailAction in Drupal 7

Assigns a system_send_email_action to the passed-in trigger.

Parameters

$trigger: For example, 'user_login'

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

File

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

Class

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

Code

function assignSystemEmailAction($trigger) {
  $form_name = "trigger_{$trigger}_assign_form";
  $form_html_id = strtr($form_name, '_', '-');
  $message = $this
    ->generateMessageWithTokens($trigger);

  // Assign a configurable action 'System message' to the passed trigger.
  $action_edit = array(
    // 'actions_label' => $trigger . "_system_send_message_action_" . $this->randomName(16),
    'actions_label' => $trigger . "_system_send_email_action",
    'recipient' => '[user:mail]',
    'subject' => $message,
    'message' => $message,
  );

  // Configure an advanced action that we can assign.
  $aid = $this
    ->configureAdvancedAction('system_send_email_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_assigned_actions');
}