-
-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13514 from totten/master-nack-rev
(dev/core#635) CRM_Utils_Cache::nack() - Fix format
- Loading branch information
Showing
3 changed files
with
31 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/** | ||
* Class CRM_Utils_CacheTest | ||
* @group headless | ||
*/ | ||
class CRM_Utils_CacheTest extends CiviUnitTestCase { | ||
|
||
public function testNack() { | ||
$values = []; | ||
for ($i = 0; $i < 5; $i++) { | ||
$nack = CRM_Utils_Cache::nack(); | ||
$this->assertRegExp('/^NACK:[a-z0-9]+$/', $nack); | ||
$values[] = $nack; | ||
} | ||
sort($values); | ||
$this->assertEquals($values, array_unique($values)); | ||
|
||
// The random token should at the start should same -- because we don't | ||
// the overhead of re-generating it frequently. | ||
$this->assertEquals(substr($values[0], 0, 37), substr($values[1], 0, 37)); | ||
} | ||
|
||
} |