Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / token / tests / src / 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 = [
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', [], $tokens, ['regex' => TRUE]);
22     $second_set = $this->assertTokens('random', [], $tokens, ['regex' => TRUE]);
23     foreach ($first_set as $token => $value) {
24       $this->assertNotIdentical($first_set[$token], $second_set[$token]);
25     }
26   }
27
28 }