Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createOrderForCustomer example
->
add
(
'createdAt',
new
\
DateTime
(
'- 25 hours'
)
)
;
$customerWithoutOrder
=
(
new
CustomerBuilder
(
$this
->ids, '10001'
)
)
->
add
(
'guest', true
)
->
add
(
'createdAt',
new
\
DateTime
(
'- 25 hours'
)
)
;
$customerRepository
->
create
(
[
$customerWithOrder
->
build
(
)
,
$customerWithoutOrder
->
build
(
)
,
]
,
$context
)
;
$this
->
createOrderForCustomer
(
$customerWithOrder
->
build
(
)
)
;
static
::
assertEquals
(
1,
$this
->service->
countUnusedCustomers
(
$context
)
)
;
$this
->service->
deleteUnusedCustomers
(
$context
)
;
static
::
assertEquals
(
0,
$this
->service->
countUnusedCustomers
(
$context
)
)
;
$result
=
$customerRepository
->
search
(
new
Criteria
(
[
$this
->ids->
get
(
'10000'
)
,
$this
->ids->
get
(
'10001'
)
,
]
)
,
$context
)
;
$customer
=
(
new
CustomerBuilder
(
$this
->ids, '10002'
)
)
->
add
(
'guest', false
)
->
add
(
'createdAt',
new
\
DateTime
(
'- 25 hours'
)
)
;
$customerRepository
->
create
(
[
$customerGuestWithOrder
->
build
(
)
,
$customerGuest
->
build
(
)
,
$customer
->
build
(
)
,
]
, Context::
createDefaultContext
(
)
)
;
$this
->
createOrderForCustomer
(
$customerGuestWithOrder
->
build
(
)
)
;
$commandTester
=
new
CommandTester
(
$this
->command
)
;
$commandTester
->
setInputs
(
[
'no'
]
)
;
$commandTester
->
execute
(
[
]
)
;
$string
=
$commandTester
->
getDisplay
(
)
;
static
::
assertIsInt
(
\
mb_strpos
(
$string
, 'Aborting due to user input.'
)
)
;
$customers
=
$customerRepository
->
search
(
(
new
Criteria
(
[
$this
->ids->
get
(
'10000'
)
,