silverstripe-framework/tests/php/Security/RandomGeneratorTest.php

32 lines
786 B
PHP
Raw Normal View History

<?php
2016-06-23 01:37:22 +02:00
2016-10-14 03:30:05 +02:00
namespace SilverStripe\Security\Tests;
2016-06-23 01:37:22 +02:00
use SilverStripe\Security\RandomGenerator;
use SilverStripe\Dev\SapphireTest;
/**
* @author Ingo Schommer
*/
class RandomGeneratorTest extends SapphireTest {
public function testGenerateEntropy() {
$r = new RandomGenerator();
$this->assertNotNull($r->generateEntropy());
$this->assertNotEquals($r->generateEntropy(), $r->generateEntropy());
}
2014-08-15 08:53:05 +02:00
public function testGenerateHash() {
$r = new RandomGenerator();
$this->assertNotNull($r->randomToken());
$this->assertNotEquals($r->randomToken(), $r->randomToken());
}
2014-08-15 08:53:05 +02:00
public function testGenerateHashWithAlgorithm() {
$r = new RandomGenerator();
$this->assertNotNull($r->randomToken('md5'));
$this->assertNotEquals($r->randomToken(), $r->randomToken('md5'));
}
2014-08-15 08:53:05 +02:00
}