diff options
Diffstat (limited to 'tests/units')
-rw-r--r-- | tests/units/Core/Ldap/LdapUserTest.php | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/tests/units/Core/Ldap/LdapUserTest.php b/tests/units/Core/Ldap/LdapUserTest.php index 2b3db1e5..b4b63053 100644 --- a/tests/units/Core/Ldap/LdapUserTest.php +++ b/tests/units/Core/Ldap/LdapUserTest.php @@ -321,8 +321,6 @@ class LdapUserTest extends Base public function testGetUserNotFound() { - $entries = new Entries(array()); - $this->client ->expects($this->any()) ->method('getConnection') @@ -376,4 +374,30 @@ class LdapUserTest extends Base $user = new User($this->query); $user->getBasDn(); } + + public function testGetLdapUserPatternNotConfigured() + { + $this->setExpectedException('\LogicException'); + + $user = new User($this->query); + $user->getLdapUserPattern('test'); + } + + public function testGetLdapUserWithMultiplePlaceholders() + { + $filter = '(|(&(objectClass=user)(mail=%s))(&(objectClass=user)(sAMAccountName=%s)))'; + $expected = '(|(&(objectClass=user)(mail=test))(&(objectClass=user)(sAMAccountName=test)))'; + + $user = new User($this->query); + $this->assertEquals($expected, $user->getLdapUserPattern('test', $filter)); + } + + public function testGetLdapUserWithOnePlaceholder() + { + $filter = '(sAMAccountName=%s)'; + $expected = '(sAMAccountName=test)'; + + $user = new User($this->query); + $this->assertEquals($expected, $user->getLdapUserPattern('test', $filter)); + } } |