summaryrefslogtreecommitdiff
path: root/tests/units
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-03-17 22:24:11 -0400
committerFrederic Guillot <fred@kanboard.net>2016-03-17 22:24:11 -0400
commit24c224ddc224f68521f3143d66754742311d2a83 (patch)
tree689a17275fde1a34aff385ee466a1778e9aca877 /tests/units
parente3e08d0e3436e3cf2f951321861e1a274cc2ebbd (diff)
Added support for multiple placeholders for LDAP_USER_FILTER
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/Core/Ldap/LdapUserTest.php28
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));
+ }
}