Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
LdapUserProvider example
public
function
testLoadUserByIdentifierFailsIfCantConnectToLdap
(
)
{
$this
->
expectException
(
ConnectionException::
class
)
;
$ldap
=
$this
->
createMock
(
LdapInterface::
class
)
;
$ldap
->
expects
(
$this
->
once
(
)
)
->
method
(
'bind'
)
->
willThrowException
(
new
ConnectionException
(
)
)
;
$provider
=
new
LdapUserProvider
(
$ldap
, 'ou=MyBusiness,dc=symfony,dc=com'
)
;
$provider
->
loadUserByIdentifier
(
'foo'
)
;
}
public
function
testLoadUserByIdentifierFailsIfNoLdapEntries
(
)
{
$this
->
expectException
(
UserNotFoundException::
class
)
;
$result
=
$this
->
createMock
(
CollectionInterface::
class
)
;
$query
=
$this
->
createMock
(
QueryInterface::
class
)
;
$query
->
expects
(
$this
->
once
(
)
)