Skip to content

Commit 4bfb881

Browse files
committed
test: add unit tests for the search terms with conversion
1 parent 4c7d9b1 commit 4bfb881

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/unit/User/UserEntryTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,23 @@ public function testGetSearchTerms() {
610610
self::assertEquals(['[email protected]', '[email protected]', 'foo'], $userEntry->getSearchTerms());
611611
}
612612

613+
public function testGetSearchTermsWithConversion() {
614+
$this->connection->expects($this->once())
615+
->method('__get')
616+
->with($this->equalTo('ldapAttributesForUserSearch'))
617+
->will($this->returnValue(['objectguid'])); // objectguid is converted by default
618+
$userEntry = new UserEntry(
619+
$this->config,
620+
$this->logger,
621+
$this->connection,
622+
[
623+
'dn' => [0 => 'cn=foo,dc=foobar,dc=bar'],
624+
'objectguid' => [0 => "\xf3\x71\xe2\x36\xa9\x48\x63\x4e\xb6\xbd\x41\xb6\x9d\x9b\x59\xb3"], // all mails should be found
625+
]
626+
);
627+
self::assertEquals(['36e271f3-48a9-4e63-b6bd-41b69d9b59b3'], $userEntry->getSearchTerms());
628+
}
629+
613630
public function testGetSearchTermsUnconfigured() {
614631
$this->connection->expects($this->once())
615632
->method('__get')

0 commit comments

Comments
 (0)