mirror of
https://github.com/RobThree/TwoFactorAuth.git
synced 2026-08-18 08:12:50 +00:00
06220d4a54
This reverts commit f6da6bee6d.
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();
|
|
}
|
|
}
|
|
}
|