You are here

function TokenRandomTestCase::testRandomTokens in Token 7

File

./token.test, line 984
Test integration for the token module.

Class

TokenRandomTestCase

Code

function testRandomTokens() {
  $tokens = array(
    'number' => '[0-9]{1,}',
    'hash:md5' => '[0-9a-f]{32}',
    'hash:sha1' => '[0-9a-f]{40}',
    'hash:sha256' => '[0-9a-f]{64}',
    'hash:invalid-algo' => NULL,
  );
  $first_set = $this
    ->assertTokens('random', array(), $tokens, array(
    'regex' => TRUE,
  ));
  $second_set = $this
    ->assertTokens('random', array(), $tokens, array(
    'regex' => TRUE,
  ));
  foreach ($first_set as $token => $value) {
    $this
      ->assertNotIdentical($first_set[$token], $second_set[$token]);
  }
}