->
willReturn('foo'
) ;
$ldap ->
expects($this->
once()) ->
method('query'
) ->
willReturn($query) ;
$provider =
new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com', null, null,
[], 'sAMAccountName', '({uid_key}={user_identifier})', 'userpassword',
['memberOf'
]);
$user =
$provider->
loadUserByIdentifier('foo'
);
$this->
assertInstanceOf(LdapUser::
class,
$user);
$this->
assertSame(['memberOf' =>
$memberOf],
$user->
getExtraFields());
} public function testRefreshUserShouldReturnUserWithSameProperties() { $ldap =
$this->
createMock(LdapInterface::
class);
$provider =
new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com', null, null,
[], 'sAMAccountName', '({uid_key}={user_identifier})', 'userpassword',
['email'
]);
$user =
new LdapUser(new Entry('foo'
), 'foo', 'bar',
['ROLE_DUMMY'
],
['email' => 'foo@symfony.com'
]);
$this->
assertEquals($user,
$provider->
refreshUser($user));
}}