Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setDocumentTypeId example
public
function
testOrderDocumentTypeRuleMatching
(
bool
$expected
, string|null
$documentId
, array
$selectedDocumentIds
, string
$operator
)
: void
{
$order
=
new
OrderEntity
(
)
;
$collection
=
new
DocumentCollection
(
)
;
if
(
$documentId
)
{
$document
=
new
DocumentEntity
(
)
;
$document
->
setId
(
Uuid::
randomHex
(
)
)
;
$document
->
setDocumentTypeId
(
$documentId
)
;
$collection
->
add
(
$document
)
;
}
$order
->
setDocuments
(
$collection
)
;
$cart
= Generator::
createCart
(
)
;
$context
= Generator::
createSalesChannelContext
(
)
;
$scope
=
new
FlowRuleScope
(
$order
,
$cart
,
$context
)
;
$this
->rule->
assign
(
[
'documentIds' =>
$selectedDocumentIds
, 'operator' =>
$operator
]
)
;
static
::
assertSame
(
$expected
,
$this
->rule->
match
(
$scope
)
)
;
}