Skip to content

Commit 9f6296a

Browse files
ACQE-7352: Fix spomky-labs/otphp deprecation messages
Created new class which implements ClockInterface to resolve TypeError in builds
1 parent debad2b commit 9f6296a

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*
6+
* NOTICE: All information contained herein is, and remains
7+
* the property of Adobe and its suppliers, if any. The intellectual
8+
* and technical concepts contained herein are proprietary to Adobe
9+
* and its suppliers and are protected by all applicable intellectual
10+
* property laws, including trade secret and copyright laws.
11+
* Dissemination of this information or reproduction of this material
12+
* is strictly forbidden unless prior written permission is obtained
13+
* from Adobe.
14+
*/
15+
declare(strict_types=1);
16+
17+
namespace Magento\FunctionalTestingFramework\DataTransport\Auth\Tfa;
18+
19+
use DateTimeImmutable;
20+
use Psr\Clock\ClockInterface;
21+
22+
class Clock implements ClockInterface
23+
{
24+
/**
25+
* Return DateTimeImmutable class object
26+
*
27+
* @return DateTimeImmutable
28+
*/
29+
public function now(): DateTimeImmutable
30+
{
31+
return new DateTimeImmutable();
32+
}
33+
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
1010
use OTPHP\TOTP;
1111
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore;
12-
use DateTimeImmutable;
1312

1413
/**
1514
* Class OTP
@@ -64,7 +63,7 @@ private static function create($path)
6463
TOTP::DEFAULT_DIGEST,
6564
TOTP::DEFAULT_DIGITS,
6665
TOTP::DEFAULT_EPOCH,
67-
new DateTimeImmutable()
66+
new Clock()
6867
);
6968
self::$totps[$path]->setIssuer('MFTF');
7069
self::$totps[$path]->setLabel('MFTF Testing');

0 commit comments

Comments
 (0)