Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ValidateResponse example
static
::
assertSame
(
0,
$this
->
getRequestCount
(
)
)
;
}
public
function
testValidateWithErrorMessage
(
)
: void
{
$paymentMethodId
=
$this
->
getPaymentMethodId
(
'prepared'
)
;
$cart
= Generator::
createCart
(
)
;
$customerId
=
$this
->
createCustomer
(
)
;
$salesChannelContext
=
$this
->
getSalesChannelContext
(
$paymentMethodId
,
$customerId
)
;
$response
=
(
new
ValidateResponse
(
)
)
->
assign
(
[
'message' => self::ERROR_MESSAGE,
]
)
;
$this
->
appendNewResponse
(
$this
->
signResponse
(
$response
->
jsonSerialize
(
)
)
)
;
if
(
!Feature::
isActive
(
'v6.6.0.0'
)
)
{
$this
->
expectException
(
ValidatePreparedPaymentException::
class
)
;
}
$this
->
expectException
(
PaymentException::
class
)
;
$this
->
expectExceptionMessageMatches
(
sprintf
(
'/%s/', self::ERROR_MESSAGE
)
)
;
$this
->preparedPaymentService->
handlePreOrderPayment
(
$cart
,
new
RequestDataBag
(
)
,
$salesChannelContext
)
;
}