mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
22095dae6c
Backported from 3.0, cc423c38fb
.
28 lines
690 B
PHP
28 lines
690 B
PHP
<?php
|
|
/**
|
|
* @package sapphire
|
|
* @subpackage tests
|
|
* @author Ingo Schommer
|
|
*/
|
|
class RandomGeneratorTest extends SapphireTest {
|
|
|
|
function testGenerateEntropy() {
|
|
$r = new RandomGenerator();
|
|
$this->assertNotNull($r->generateEntropy());
|
|
$this->assertNotEquals($r->generateEntropy(), $r->generateEntropy());
|
|
}
|
|
|
|
function testGenerateHash() {
|
|
$r = new RandomGenerator();
|
|
$this->assertNotNull($r->randomToken());
|
|
$this->assertNotEquals($r->randomToken(), $r->randomToken());
|
|
}
|
|
|
|
function testGenerateHashWithAlgorithm() {
|
|
$r = new RandomGenerator();
|
|
$this->assertNotNull($r->randomToken('md5'));
|
|
$this->assertNotEquals($r->randomToken(), $r->randomToken('md5'));
|
|
}
|
|
|
|
}
|