Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setHandlers example
'passwordConfirm' => 'NewPassword!',
]
)
;
static
::
assertEquals
(
400,
$this
->
getBrowser
(
)
->
getResponse
(
)
->
getStatusCode
(
)
)
;
}
public
function
testCreateUserRecovery
(
)
: void
{
$logger
=
$this
->
getContainer
(
)
->
get
(
'monolog.logger.business_events'
)
;
$handlers
=
$logger
->
getHandlers
(
)
;
$logger
->
setHandlers
(
[
new
ExcludeFlowEventHandler
(
$this
->
getContainer
(
)
->
get
(
DoctrineSQLHandler::
class
)
,
[
UserRecoveryRequestEvent::EVENT_NAME,
]
)
,
]
)
;
$dispatchedEvent
= null;
$this
->
addEventListener
(
$this
->
getContainer
(
)
->
get
(
'event_dispatcher'
)
,
UserRecoveryRequestEvent::EVENT_NAME,
function
DUserRecoveryRequestEvent
$event
)
use
(
&
$dispatchedEvent
)
: void
{
$this
->
getContainer
(
)
->
get
(
'request_stack'
)
->
push
(
$request
)
;
$response
=
$controller
->
login
(
$request
,
new
RequestDataBag
(
$request
->attributes->
all
(
)
)
,
$this
->salesChannelContext
)
;
static
::
assertEquals
(
200,
$response
->
getStatusCode
(
)
)
;
}
public
function
testGenerateAccountRecovery
(
)
: void
{
$logger
=
$this
->
getContainer
(
)
->
get
(
'monolog.logger.business_events'
)
;
$handlers
=
$logger
->
getHandlers
(
)
;
$logger
->
setHandlers
(
[
new
ExcludeFlowEventHandler
(
$this
->
getContainer
(
)
->
get
(
DoctrineSQLHandler::
class
)
,
[
CustomerAccountRecoverRequestEvent::EVENT_NAME,
]
)
,
]
)
;
$testSubscriber
=
new
AuthTestSubscriber
(
)
;
$this
->
getContainer
(
)
->
get
(
'event_dispatcher'
)
->
addSubscriber
(
$testSubscriber
)
;
/** @var CustomerEntity|null $customer */
$customer
=
$this
->
createCustomer
(
)
;
static
::
assertNotNull
(
$customer
)
;
current
(
$this
->logger->
getHandlers
(
)
)
instanceof NullHandler
||
current
(
$this
->logger->
getHandlers
(
)
)
instanceof RotatingFileHandler
)
)
)
{
$filepath
=
sprintf
(
$this
->rotatingFilePathPattern,
$filePrefix
)
;
$result
->
pushHandler
(
new
RotatingFileHandler
(
$filepath
,
$fileRotationCount
??
$this
->defaultFileRotationCount,
$loggerLevel
)
)
;
return
$result
;
}
$result
->
setHandlers
(
$this
->logger->
getHandlers
(
)
)
;
return
$result
;
}
}