Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setPaymentFailed example
static
::
assertEquals
(
'danger error.CHECKOUT__ORDER_ORDER_NOT_FOUND',
$this
->controller->flash
)
;
static
::
assertEquals
(
new
RedirectResponse
(
'url'
)
,
$response
)
;
}
public
function
testFinishPagePaymentFailed
(
)
: void
{
$context
=
$this
->
createMock
(
SalesChannelContext::
class
)
;
$context
->
method
(
'getCustomer'
)
->
willReturn
(
new
CustomerEntity
(
)
)
;
$page
=
new
CheckoutFinishPage
(
)
;
$page
->
setPaymentFailed
(
true
)
;
$this
->finishPageLoaderMock->
method
(
'load'
)
->
willReturn
(
$page
)
;
$response
=
$this
->controller->
finishPage
(
new
Request
(
)
,
$context
,
new
RequestDataBag
(
)
)
;
static
::
assertEquals
(
new
RedirectResponse
(
'url'
)
,
$response
)
;
}
public
function
testFinishPageGuestLogout
(
)
: void
{
$customer
=
new
CustomerEntity
(
)
;
if
(
$page
->
getMetaInformation
(
)
)
{
$page
->
getMetaInformation
(
)
->
setRobots
(
'noindex,follow'
)
;
}
Profiler::
trace
(
'finish-page-order-loading',
function
D
)
use
(
$page
,
$request
,
$salesChannelContext
)
: void
{
$page
->
setOrder
(
$this
->
getOrder
(
$request
,
$salesChannelContext
)
)
;
}
)
;
$page
->
setChangedPayment
(
(bool)
$request
->
get
(
'changedPayment', false
)
)
;
$page
->
setPaymentFailed
(
(bool)
$request
->
get
(
'paymentFailed', false
)
)
;
$this
->eventDispatcher->
dispatch
(
new
CheckoutFinishPageLoadedEvent
(
$page
,
$salesChannelContext
,
$request
)
)
;
if
(
$page
->
getOrder
(
)
->
getItemRounding
(
)
)
{
$salesChannelContext
->
setItemRounding
(
$page
->
getOrder
(
)
->
getItemRounding
(
)
)
;
$salesChannelContext
->
getContext
(
)
->
setRounding
(
$page
->
getOrder
(
)
->
getItemRounding
(
)
)
;
}
if
(
$page
->
getOrder
(
)
->
getTotalRounding
(
)
)
{
$salesChannelContext
->
setTotalRounding
(
$page
->
getOrder
(
)
->
getTotalRounding
(
)
)
;
}