phpmyadmin/test/classes/Plugins/TwoFactor/KeyTest.php
Maurício Meneghini Fauth 7fc96d6621
Call PHPUnit static methods using static calls
Backports #18907 to QA_5_2.

This makes merging QA_5_2 into master easier.
Changes done using Rector.

- #18907

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2024-10-12 14:28:22 -03:00

46 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests\Plugins\TwoFactor;
use PhpMyAdmin\Plugins\TwoFactor\Key;
use PhpMyAdmin\Tests\AbstractTestCase;
use PhpMyAdmin\TwoFactor;
/**
* @covers \PhpMyAdmin\Plugins\TwoFactor\Key
*/
class KeyTest extends AbstractTestCase
{
public function testGetRegistrations(): void
{
$twoFactor = $this->createStub(TwoFactor::class);
$twoFactor->config = [
'backend' => 'key',
'settings' => [
'registrations' => [
[
'keyHandle' => 'keyHandle',
'publicKey' => 'publicKey',
'certificate' => 'certificate',
'counter' => -1,
],
],
],
];
$key = new Key($twoFactor);
$actual = $key->getRegistrations();
$expected = [
(object) [
'keyHandle' => 'keyHandle',
'publicKey' => 'publicKey',
'certificate' => 'certificate',
'counter' => -1,
'index' => 0,
],
];
self::assertEquals($expected, $actual);
}
}