v1.0 Initial commit of project
This commit is contained in:
21
vendor/robthree/twofactorauth/tests/Providers/Rng/CSRNGProviderTest.php
vendored
Normal file
21
vendor/robthree/twofactorauth/tests/Providers/Rng/CSRNGProviderTest.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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;
|
||||
|
||||
public function testCSRNGProvidersReturnExpectedNumberOfBytes(): void
|
||||
{
|
||||
$rng = new CSRNGProvider();
|
||||
foreach ($this->rngTestLengths as $l) {
|
||||
$this->assertSame($l, strlen($rng->getRandomBytes($l)));
|
||||
}
|
||||
}
|
||||
}
|
||||
19
vendor/robthree/twofactorauth/tests/Providers/Rng/IRNGProviderTest.php
vendored
Normal file
19
vendor/robthree/twofactorauth/tests/Providers/Rng/IRNGProviderTest.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Providers\Rng;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use RobThree\Auth\Algorithm;
|
||||
use RobThree\Auth\TwoFactorAuth;
|
||||
use Tests\Providers\Qr\TestQrProvider;
|
||||
|
||||
class IRNGProviderTest extends TestCase
|
||||
{
|
||||
public function testCreateSecret(): void
|
||||
{
|
||||
$tfa = new TwoFactorAuth(new TestQrProvider(), 'Test', 6, 30, Algorithm::Sha1, null, null);
|
||||
$this->assertIsString($tfa->createSecret());
|
||||
}
|
||||
}
|
||||
11
vendor/robthree/twofactorauth/tests/Providers/Rng/NeedsRngLengths.php
vendored
Normal file
11
vendor/robthree/twofactorauth/tests/Providers/Rng/NeedsRngLengths.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Providers\Rng;
|
||||
|
||||
trait NeedsRngLengths
|
||||
{
|
||||
/** @var array<int> */
|
||||
protected $rngTestLengths = array(1, 16, 32, 256);
|
||||
}
|
||||
Reference in New Issue
Block a user