mirror of
https://github.com/RobThree/TwoFactorAuth.git
synced 2026-10-20 02:35:33 +00:00
d1792f07d1
and remove the openssl provider. We now rely exclusively on random_bytes(), as there are no reasons not to. Fix #121
29 lines
661 B
PHP
29 lines
661 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Providers\Rng;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use RobThree\Auth\Providers\Rng\CSRNGProvider;
|
|
|
|
class CSRNGProviderTest extends TestCase
|
|
{
|
|
use NeedsRngLengths;
|
|
|
|
/**
|
|
* @requires function random_bytes
|
|
*/
|
|
public function testCSRNGProvidersReturnExpectedNumberOfBytes(): void
|
|
{
|
|
if (function_exists('random_bytes')) {
|
|
$rng = new CSRNGProvider();
|
|
foreach ($this->rngTestLengths as $l) {
|
|
$this->assertSame($l, strlen($rng->getRandomBytes($l)));
|
|
}
|
|
} else {
|
|
$this->expectNotToPerformAssertions();
|
|
}
|
|
}
|
|
}
|