You are here

function PathautoTestHelper::assertToken in Pathauto 7

Same name and namespace in other branches
  1. 6.2 pathauto.test \PathautoTestHelper::assertToken()
  2. 6 pathauto.test \PathautoTestHelper::assertToken()

File

./pathauto.test, line 22
Functionality tests for Pathauto.

Class

PathautoTestHelper
Helper test class with some added functions for testing.

Code

function assertToken($type, $object, $token, $expected) {
  $tokens = token_generate($type, array(
    $token => $token,
  ), array(
    $type => $object,
  ));
  $tokens += array(
    $token => '',
  );
  $this
    ->assertIdentical($tokens[$token], $expected, t("Token value for [@type:@token] was '@actual', expected value '@expected'.", array(
    '@type' => $type,
    '@token' => $token,
    '@actual' => $tokens[$token],
    '@expected' => $expected,
  )));
}