Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getCheckoutScope example
'debug' => false,
'cacheDir' =>
$this
->
getContainer
(
)
->
getParameter
(
'kernel.cache_dir'
)
,
]
)
;
static
::
assertTrue
(
$rule
->
match
(
$scope
)
)
;
}
public
function
testRuleIsConsistent
(
)
: void
{
$this
->
installApp
(
)
;
$ruleId
= Uuid::
randomHex
(
)
;
$expectedTrueScope
=
$this
->
getCheckoutScope
(
$ruleId
)
;
$salesChannelContext
=
$this
->
createMock
(
SalesChannelContext::
class
)
;
$customer
=
new
CustomerEntity
(
)
;
$customer
->
setGroupId
(
Uuid::
randomHex
(
)
)
;
$salesChannelContext
->
method
(
'getCustomer'
)
->
willReturn
(
$customer
)
;
$expectedFalseScope
=
new
CheckoutRuleScope
(
$salesChannelContext
)
;
/** @var RuleEntity $rule */
$rule
=
$this
->ruleRepository->
search
(
new
Criteria
(
[
$ruleId
]
)
,
$this
->context
)
->
get
(
$ruleId
)
;
$payload
=
$rule
->
getPayload
(
)
;
static
::
assertInstanceOf
(
Rule::
class
,
$payload
)
;