2010-12-05 01:19:57 +01:00
|
|
|
<?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();
|
2012-11-09 01:37:35 +01:00
|
|
|
$this->assertNotNull($r->randomToken());
|
|
|
|
$this->assertNotEquals($r->randomToken(), $r->randomToken());
|
2010-12-05 01:19:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function testGenerateHashWithAlgorithm() {
|
|
|
|
$r = new RandomGenerator();
|
2012-11-09 01:37:35 +01:00
|
|
|
$this->assertNotNull($r->randomToken('md5'));
|
|
|
|
$this->assertNotEquals($r->randomToken(), $r->randomToken('md5'));
|
2010-12-05 01:19:57 +01:00
|
|
|
}
|
|
|
|
|
2012-11-09 01:37:35 +01:00
|
|
|
}
|