silverstripe-framework/tests/security/RandomGeneratorTest.php
2012-09-20 10:46:59 +02:00

28 lines
718 B
PHP

<?php
/**
* @package framework
* @subpackage tests
* @author Ingo Schommer
*/
class RandomGeneratorTest extends SapphireTest {
public function testGenerateEntropy() {
$r = new RandomGenerator();
$this->assertNotNull($r->generateEntropy());
$this->assertNotEquals($r->generateEntropy(), $r->generateEntropy());
}
public function testGenerateHash() {
$r = new RandomGenerator();
$this->assertNotNull($r->generateHash());
$this->assertNotEquals($r->generateHash(), $r->generateHash());
}
public function testGenerateHashWithAlgorithm() {
$r = new RandomGenerator();
$this->assertNotNull($r->generateHash('md5'));
$this->assertNotEquals($r->generateHash(), $r->generateHash('md5'));
}
}