This repository has been archived on 2025-09-29. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
drupalcampbristol/web/modules/contrib/token/tests/src/Kernel/RandomTest.php
2017-05-22 15:12:47 +01:00

27 lines
692 B
PHP

<?php
namespace Drupal\Tests\token\Kernel;
/**
* Tests random tokens.
*
* @group token
*/
class RandomTest extends KernelTestBase {
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]);
}
}
}