class JWTFactoryV2Test extends TestCase
{ private JWTFactoryV2
$tokenFactory;
protected function setUp(): void
{ $configuration = Configuration::
forSymmetricSigner(new TestSigner(),
new TestKey());
$configuration->
setValidationConstraints(new NoopConstraint());
$connection =
$this->
createMock(Connection::
class);
$this->tokenFactory =
new JWTFactoryV2($configuration,
$connection);
} /**
* @dataProvider dataProviderExpiration
*/
public function testGenerateAndGetToken(int
$expiration, bool
$expired): void
{ $transaction = self::
createTransaction();
$tokenStruct =
new TokenStruct(null, null,
$transaction->
getPaymentMethodId(),
$transaction->
getId(), null,
$expiration);
$token =
$this->tokenFactory->
generateToken($tokenStruct);
$tokenStruct =
$this->tokenFactory->
parseToken($token);