Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
updateFinishedDone example
$notificationServiceMock
=
$this
->
createMock
(
NotificationService::
class
)
;
$notificationServiceMock
->
expects
(
static
::
once
(
)
)
->
method
(
'createNotification'
)
->
with
(
new
TraversableContainsIdentical
(
'Updated successfully to version ' .
$version
)
)
;
$eventMock
=
$this
->
createMock
(
UpdatePostFinishEvent::
class
)
;
$eventMock
->
expects
(
static
::
any
(
)
)
->
method
(
'getContext'
)
->
willReturn
(
$context
)
;
$eventMock
->
expects
(
static
::
any
(
)
)
->
method
(
'getNewVersion'
)
->
willReturn
(
$version
)
;
$updateSubscriber
=
new
UpdateSubscriber
(
$notificationServiceMock
)
;
$updateSubscriber
->
updateFinishedDone
(
$eventMock
)
;
}
public
function
testUpdateSucessfullAdminScope
(
)
: void
{
$context
= Context::
createDefaultContext
(
new
AdminApiSource
(
'userId123', 'integrationId321'
)
)
;
$version
= '6.0.1_test';
$notificationServiceMock
=
$this
->
createMock
(
NotificationService::
class
)
;
$notificationServiceMock
->
expects
(
static
::
once
(
)
)
->
method
(
'createNotification'
)
->
willReturnCallback
(
function
D
$data
)
: void
{
static
::
assertContains
(
'success',
$data
)
;