$struct =
new AsyncPaymentTransactionStruct($transaction,
$order, ''
);
$paymentStructFactory =
$this->
createMock(AbstractPaymentTransactionStructFactory::
class);
$paymentStructFactory->
expects(static::
once())->
method('async'
)->
willReturn($struct);
$paymentHandler =
$this->
createMock(AsynchronousPaymentHandlerInterface::
class);
$paymentHandler->
expects(static::
once())->
method('finalize'
)->
with($struct,
$request,
$context);
$paymentHandlerRegistry =
$this->
createMock(PaymentHandlerRegistry::
class);
$paymentHandlerRegistry->
expects(static::
once())->
method('getAsyncPaymentHandler'
)->
willReturn($paymentHandler);
$paymentService =
new PaymentService( $this->
createMock(PaymentTransactionChainProcessor::
class),
$tokenFactory,
$paymentHandlerRegistry,
$transactionRepository,
$this->
createMock(OrderTransactionStateHandler::
class),
$this->
createMock(LoggerInterface::
class),
$this->
createMock(EntityRepository::
class),
$this->
createMock(SalesChannelContextServiceInterface::
class),
$paymentStructFactory,
$eventDispatcher );