Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createTestOrderAndReturnCustomer example
$defaultContext
)
;
static
::
assertNotNull
(
$result
->
first
(
)
)
;
static
::
assertSame
(
1,
$result
->
first
(
)
->
getOrderCount
(
)
)
;
static
::
assertNotNull
(
$result
->
first
(
)
->
getLastOrderDate
(
)
)
;
}
private
function
createRealTestScope
(
)
: CheckoutRuleScope
{
$checkoutContext
=
$this
->
createMock
(
SalesChannelContext::
class
)
;
$customer
=
$this
->
createTestOrderAndReturnCustomer
(
)
;
$checkoutContext
->
method
(
'getCustomer'
)
->
willReturn
(
$customer
)
;
return
new
CheckoutRuleScope
(
$checkoutContext
)
;
}
private
function
createTestOrderAndReturnCustomer
(
)
: CustomerEntity
{
/** @var EntityRepository $customerRepository */
$customerRepository
=
$this
->
getContainer
(
)
->
get
(
'customer.repository'
)
;