2010-12-05 01:18:19 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2012-04-12 08:02:46 +02:00
|
|
|
* @package framework
|
2010-12-05 01:18:19 +01:00
|
|
|
* @subpackage tests
|
|
|
|
* @author Ingo Schommer
|
|
|
|
*/
|
|
|
|
class RandomGeneratorTest extends SapphireTest {
|
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testGenerateEntropy() {
|
2010-12-05 01:18:19 +01:00
|
|
|
$r = new RandomGenerator();
|
|
|
|
$this->assertNotNull($r->generateEntropy());
|
|
|
|
$this->assertNotEquals($r->generateEntropy(), $r->generateEntropy());
|
|
|
|
}
|
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testGenerateHash() {
|
2010-12-05 01:18:19 +01:00
|
|
|
$r = new RandomGenerator();
|
|
|
|
$this->assertNotNull($r->generateHash());
|
|
|
|
$this->assertNotEquals($r->generateHash(), $r->generateHash());
|
|
|
|
}
|
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testGenerateHashWithAlgorithm() {
|
2010-12-05 01:18:19 +01:00
|
|
|
$r = new RandomGenerator();
|
|
|
|
$this->assertNotNull($r->generateHash('md5'));
|
|
|
|
$this->assertNotEquals($r->generateHash(), $r->generateHash('md5'));
|
|
|
|
}
|
|
|
|
|
2012-03-24 04:04:52 +01:00
|
|
|
}
|