function TriggerActionTestCase::assignSimpleAction
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
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,
)));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.