a4b09303dbae21402893a5b4faef0f013b880aad
[yaffs-website] / Kernel / RandomTest.php
1 <?php
2
3 namespace Drupal\Tests\token\Kernel;
4
5 /**
6  * Tests random tokens.
7  *
8  * @group token
9  */
10 class RandomTest extends KernelTestBase {
11
12   function testRandomTokens() {
13     $tokens = array(
14       'number' => '[0-9]{1,}',
15       'hash:md5' => '[0-9a-f]{32}',
16       'hash:sha1' => '[0-9a-f]{40}',
17       'hash:sha256' => '[0-9a-f]{64}',
18       'hash:invalid-algo' => NULL,
19     );
20
21     $first_set = $this->assertTokens('random', array(), $tokens, array('regex' => TRUE));
22     $second_set = $this->assertTokens('random', array(), $tokens, array('regex' => TRUE));
23     foreach ($first_set as $token => $value) {
24       $this->assertNotIdentical($first_set[$token], $second_set[$token]);
25     }
26   }
27 }