You are here

function TriggerActionTestCase::generateTokenExpandedComparison in Drupal 7

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
Tests for trigger.module.

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);
}