function TriggerActionTestCase::assignSimpleAction in Drupal 7
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 modules/
trigger/ trigger.test - Tests user action assignment and execution.
File
- 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,
)));
}