mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-12 16:36:30 +00:00
Merge pull request #533 from bantu/random-tests-php5
Some tests for crypt_random_string(). * bantu/random-tests-php5: crypt_random_string() -> Random::string()
This commit is contained in:
commit
6b8079f87a
@ -5,6 +5,8 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use phpseclib\Crypt\Random;
|
||||||
|
|
||||||
class Unit_Crypt_RandomTest extends PhpseclibTestCase
|
class Unit_Crypt_RandomTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
public function stringLengthData()
|
public function stringLengthData()
|
||||||
@ -21,7 +23,7 @@ class Unit_Crypt_RandomTest extends PhpseclibTestCase
|
|||||||
{
|
{
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
$length,
|
$length,
|
||||||
strlen(crypt_random_string($length)),
|
strlen(Random::string($length)),
|
||||||
'Failed asserting that a string of expected length was generated.'
|
'Failed asserting that a string of expected length was generated.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -34,7 +36,7 @@ class Unit_Crypt_RandomTest extends PhpseclibTestCase
|
|||||||
{
|
{
|
||||||
$values = array();
|
$values = array();
|
||||||
for ($i = 0; $i < 10000; ++$i) {
|
for ($i = 0; $i < 10000; ++$i) {
|
||||||
$rand = crypt_random_string(16);
|
$rand = Random::string(16);
|
||||||
$this->assertSame(16, strlen($rand));
|
$this->assertSame(16, strlen($rand));
|
||||||
$this->assertArrayNotHasKey(
|
$this->assertArrayNotHasKey(
|
||||||
$rand,
|
$rand,
|
||||||
|
Loading…
Reference in New Issue
Block a user