silverstripe-framework/tests/security/RandomGeneratorTest.php
2012-11-09 12:03:55 +01:00

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'));
}
}