Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
frwStart example
// Response for request of TrackingEventClient::fireTrackingEvent()
$this
->
getRequestHandler
(
)
->
append
(
new
Response
(
)
)
;
$this
->
addEventListener
(
$this
->
getContainer
(
)
->
get
(
'event_dispatcher'
)
,
FirstRunWizardStartedEvent::
class
,
function
DFirstRunWizardStartedEvent
$event
)
use
(
&
$dispatchedEvent
)
: void
{
$dispatchedEvent
=
$event
;
}
)
;
$this
->frwController->
frwStart
(
Context::
createDefaultContext
(
)
)
;
static
::
assertInstanceOf
(
FirstRunWizardStartedEvent::
class
,
$dispatchedEvent
)
;
$lastRequest
=
$this
->
getRequestHandler
(
)
->
getLastRequest
(
)
;
static
::
assertInstanceOf
(
Request::
class
,
$lastRequest
)
;
static
::
assertEquals
(
'POST',
$lastRequest
->
getMethod
(
)
)
;
static
::
assertEquals
(
'/swplatform/tracking/events',
$lastRequest
->
getUri
(
)
->
getPath
(
)
)
;
}
public
function
testFrwLoginStoresFrwUserToken
(
)
: void
{
public
function
testStartFrw
(
)
: void
{
$this
->firstRunWizardService->
expects
(
static
::
once
(
)
)
->
method
(
'startFrw'
)
;
$frwController
=
new
FirstRunWizardController
(
$this
->firstRunWizardService,
new
StaticEntityRepository
(
[
]
)
,
new
StaticEntityRepository
(
[
]
)
,
)
;
$response
=
$frwController
->
frwStart
(
$this
->
createContext
(
)
)
;
static
::
assertSame
(
SymfonyResponse::HTTP_OK,
$response
->
getStatusCode
(
)
)
;
}
public
function
testTryingToStartFrwFails
(
)
: void
{
$exceptionMessage
= 'frwService::frwStart failed';
$this
->firstRunWizardService->
expects
(
static
::
once
(
)
)
->
method
(
'startFrw'
)
->
willThrowException
(
$this
->
createClientException
(
$exceptionMessage
)
)
;