Merge pull request #15338 from totten/master-poc-postcommit
[civicrm-core.git] / tests / phpunit / CRM / Utils / CacheTest.php
CommitLineData
89861474
TO
1<?php
2
3/**
4 * Class CRM_Utils_CacheTest
5 * @group headless
6 */
7class CRM_Utils_CacheTest extends CiviUnitTestCase {
8
9 public function testNack() {
10 $values = [];
11 for ($i = 0; $i < 5; $i++) {
12 $nack = CRM_Utils_Cache::nack();
13 $this->assertRegExp('/^NACK:[a-z0-9]+$/', $nack);
14 $values[] = $nack;
15 }
16 sort($values);
17 $this->assertEquals($values, array_unique($values));
18
19 // The random token should at the start should same -- because we don't
20 // the overhead of re-generating it frequently.
21 $this->assertEquals(substr($values[0], 0, 37), substr($values[1], 0, 37));
22 }
23
24}