Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getExceptionListener example
$this
->map =
$map
;
}
public
function
getListeners
(
Request
$request
)
: array
{
$context
=
$this
->
getFirewallContext
(
$request
)
;
if
(
null ===
$context
)
{
return
[
[
]
, null, null
]
;
}
return
[
$context
->
getListeners
(
)
,
$context
->
getExceptionListener
(
)
,
$context
->
getLogoutListener
(
)
]
;
}
public
function
getFirewallConfig
(
Request
$request
)
: ?FirewallConfig
{
$context
=
$this
->
getFirewallContext
(
$request
)
;
if
(
null ===
$context
)
{
return
null;
}
return
$context
->
getConfig
(
)
;
}
public
function
testGetters
(
)
{
$config
=
new
FirewallConfig
(
'main', 'user_checker', 'request_matcher'
)
;
$exceptionListener
=
$this
->
getExceptionListenerMock
(
)
;
$logoutListener
=
$this
->
getLogoutListenerMock
(
)
;
$listeners
=
[
function
D
)
{
}
]
;
$context
=
new
FirewallContext
(
$listeners
,
$exceptionListener
,
$logoutListener
,
$config
)
;
$this
->
assertEquals
(
$listeners
,
$context
->
getListeners
(
)
)
;
$this
->
assertEquals
(
$exceptionListener
,
$context
->
getExceptionListener
(
)
)
;
$this
->
assertEquals
(
$logoutListener
,
$context
->
getLogoutListener
(
)
)
;
$this
->
assertEquals
(
$config
,
$context
->
getConfig
(
)
)
;
}
private
function
getExceptionListenerMock
(
)
{
return
$this
->
getMockBuilder
(
ExceptionListener::
class
)
->
disableOriginalConstructor
(
)
->
getMock
(
)
;
}