Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
resetServices example
/** * @dataProvider provideResetServices */
public
function
testResetServices
(
bool
$shouldReset
)
{
$servicesResetter
=
$this
->
createMock
(
ServicesResetter::
class
)
;
$servicesResetter
->
expects
(
$shouldReset
?
$this
->
once
(
)
:
$this
->
never
(
)
)
->
method
(
'reset'
)
;
$event
=
new
WorkerRunningEvent
(
$this
->
createMock
(
Worker::
class
)
, !
$shouldReset
)
;
$resetListener
=
new
ResetServicesListener
(
$servicesResetter
)
;
$resetListener
->
resetServices
(
$event
)
;
}
public
function
testResetServicesAtStop
(
)
{
$servicesResetter
=
$this
->
createMock
(
ServicesResetter::
class
)
;
$servicesResetter
->
expects
(
$this
->
once
(
)
)
->
method
(
'reset'
)
;
$event
=
new
WorkerStoppedEvent
(
$this
->
createMock
(
Worker::
class
)
)
;
$resetListener
=
new
ResetServicesListener
(
$servicesResetter
)
;
$resetListener
->
resetServicesAtStop
(
$event
)
;
}