Skip to content

Commit 3b7549f

Browse files
ACQE-7352: Fix spomky-labs/otphp deprecation messages
1 parent 42dd3fc commit 3b7549f

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\FunctionalTestingFramework\DataTransport\Auth\Tfa;
9+
10+
use DateTimeImmutable;
11+
use Psr\Clock\ClockInterface;
12+
13+
class Clock implements ClockInterface
14+
{
15+
/**
16+
* Return DateTimeImmutable class object
17+
*
18+
* @return DateTimeImmutable
19+
*/
20+
public function now(): DateTimeImmutable
21+
{
22+
return new DateTimeImmutable();
23+
}
24+
}

src/Magento/FunctionalTestingFramework/DataTransport/Auth/Tfa/OTP.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ private static function create($path)
5757
throw new TestFrameworkException('Unable to get OTP' . PHP_EOL . $e->getMessage());
5858
}
5959

60-
self::$totps[$path] = TOTP::create($secret);
60+
self::$totps[$path] = TOTP::create(
61+
$secret,
62+
TOTP::DEFAULT_PERIOD,
63+
TOTP::DEFAULT_DIGEST,
64+
TOTP::DEFAULT_DIGITS,
65+
TOTP::DEFAULT_EPOCH,
66+
new Clock()
67+
);
6168
self::$totps[$path]->setIssuer('MFTF');
6269
self::$totps[$path]->setLabel('MFTF Testing');
6370
}

0 commit comments

Comments
 (0)