Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
RemoteUserAuthenticator example
public
function
testSupport
(
InMemoryUserProvider
$userProvider
, RemoteUserAuthenticator
$authenticator
,
$parameterName
)
{
$request
=
$this
->
createRequest
(
[
$parameterName
=> 'TheUsername'
]
)
;
$this
->
assertTrue
(
$authenticator
->
supports
(
$request
)
)
;
}
public
function
testSupportNoUser
(
)
{
$authenticator
=
new
RemoteUserAuthenticator
(
new
InMemoryUserProvider
(
)
,
new
TokenStorage
(
)
, 'main'
)
;
$this
->
assertFalse
(
$authenticator
->
supports
(
$this
->
createRequest
(
[
]
)
)
)
;
}
public
function
testSupportTokenStorageWithToken
(
)
{
$tokenStorage
=
new
TokenStorage
(
)
;
$tokenStorage
->
setToken
(
new
PreAuthenticatedToken
(
new
InMemoryUser
(
'username', null
)
, 'main'
)
)
;
$authenticator
=
new
RemoteUserAuthenticator
(
new
InMemoryUserProvider
(
)
,
$tokenStorage
, 'main'
)
;