Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function TriggerActionTestCase::generateTokenExpandedComparison

Generates a comparison message to match the pre-token-replaced message.

Parameters

$trigger: Trigger, like 'user_login'.

$account: Associated user account.

Return value

The token-replaced equivalent message. This does not use token functionality.

See also

generateMessageWithTokens()

2 calls to TriggerActionTestCase::generateTokenExpandedComparison()
TriggerActionTestCase::assertSystemEmailTokenReplacement in modules/trigger/trigger.test
Asserts correct token replacement for the given trigger and account.
TriggerActionTestCase::assertSystemMessageTokenReplacement in modules/trigger/trigger.test
Asserts correct token replacement for the given trigger and account.

File

modules/trigger/trigger.test, line 291

Class

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

Code

function generateTokenExpandedComparison($trigger, $account) {
 // Note that user:last-login was omitted because it changes and can't
 // be properly verified.
 $message = t ('Action was triggered by trigger @trigger user:name=@username user:uid=@uid user:mail=@mail user:url=@user_url user:edit-url=@user_edit_url user:created=@user_created', array(
 '@trigger' => $trigger,
 '@username' => $account->name ,
 '@uid' => !empty($account->uid) ? $account->uid : t ('not yet assigned'),
 '@mail' => $account->mail,
 '@user_url' => !empty($account->uid) ? url ("user/{$account->uid}", array(
 'absolute' => TRUE,
 )) : t ('not yet assigned'),
 '@user_edit_url' => !empty($account->uid) ? url ("user/{$account->uid}/edit", array(
 'absolute' => TRUE,
 )) : t ('not yet assigned'),
 '@user_created' => isset($account->created) ? format_date ($account->created, 'medium') : t ('not yet created'),
 ));
 return trim ($message);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.