function TriggerActionTestCase::assignSimpleAction

7.x trigger.test TriggerActionTestCase::assignSimpleAction($trigger, $action)

Assigns a simple (non-configurable) action to a trigger.

Parameters

$trigger: The trigger to assign to, like 'user_login'.

$action: The simple action to be assigned, like 'comment_insert'.

1 call to TriggerActionTestCase::assignSimpleAction()
TriggerUserActionTestCase::testUserActionAssignmentExecution in drupal-7.x/modules/trigger/trigger.test
Tests user action assignment and execution.

File

drupal-7.x/modules/trigger/trigger.test, line 317
Tests for trigger.module.

Class

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

Code

function assignSimpleAction($trigger, $action) {
  $form_name = "trigger_{$trigger}_assign_form";
  $form_html_id = strtr($form_name, '_', '-');
  $edit = array('aid' => drupal_hash_base64($action));
  $trigger_type = preg_replace('/_.*/', '', $trigger);
  $this->drupalPost("admin/structure/trigger/$trigger_type", $edit, t('Assign'), array(), array(), $form_html_id);
  $actions = trigger_get_assigned_actions($trigger);
  $this->assertTrue(!empty($actions[$action]), format_string('Simple action @action assigned to trigger @trigger', array('@action' => $action, '@trigger' => $trigger)));
}