Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
changeTransactionStateToPaid example
'id' =>
$ids
->
get
(
'order'
)
,
'tags' =>
[
[
'id' =>
$ids
->
get
(
'tag-1'
)
]
,
]
,
]
,
]
,
$this
->salesChannelContext->
getContext
(
)
)
;
$this
->productRepository->
update
(
[
(
new
ProductBuilder
(
$ids
, 'product'
)
)
->
price
(
50
)
->
build
(
)
,
]
,
$this
->salesChannelContext->
getContext
(
)
)
;
$this
->
changeTransactionStateToPaid
(
$ids
->
get
(
'order'
)
)
;
$criteria
=
new
Criteria
(
[
$ids
->
get
(
'order'
)
]
)
;
$criteria
->
addAssociation
(
'tags'
)
;
$order
=
$this
->orderRepository
->
search
(
$criteria
,
$this
->salesChannelContext->
getContext
(
)
)
->
first
(
)
;
static
::
assertInstanceOf
(
OrderEntity::
class
,
$order
)
;
static
::
assertInstanceOf
(
TagCollection::
class
,
$order
->
getTags
(
)
)
;
static
::
assertContains
(
$ids
->
get
(
'tag-1'
)
,
$order
->
getTags
(
)
->
getIds
(
)
)
;
$mailEvent
= null;
$mailListener
=
function
DMailBeforeSentEvent
$event
)
use
(
&
$mailEvent
)
: void
{
$event
=
$this
->
onMailBeforeSentEvent
(
$event
)
;
if
(
$event
instanceof MailBeforeSentEvent
)
{
$mailEvent
=
$event
;
}
}
;
$this
->
addEventListener
(
$this
->eventDispatcher, MailBeforeSentEvent::
class
,
$mailListener
)
;
$this
->
changeTransactionStateToPaid
(
$orderId
)
;
$this
->
resetEventDispatcher
(
)
;
$this
->
assertDispatchedFlowEvent
(
$productDownloads
,
$flowEvent
)
;
$this
->
assertDispatchedMailEvent
(
$productDownloads
,
$mailEvent
)
;
$this
->
assertOrderWithGrantedAccess
(
$orderId
,
$productDownloads
)
;
}
/** * @param array<int, string[]> $productDownloads * * @dataProvider orderCaseProvider */