Skip to content

Commit

Permalink
test: add unit tests for the search terms with conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
jvillafanez committed Jun 17, 2024
1 parent e09e87f commit 4b25d15
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/unit/User/UserEntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,23 @@ public function testGetSearchTerms() {
self::assertEquals(['[email protected]', '[email protected]', 'foo'], $userEntry->getSearchTerms());
}

public function testGetSearchTermsWithConversion() {
$this->connection->expects($this->once())
->method('__get')
->with($this->equalTo('ldapAttributesForUserSearch'))
->will($this->returnValue(['objectguid'])); // objectguid is converted by default
$userEntry = new UserEntry(
$this->config,
$this->logger,
$this->connection,
[
'dn' => [0 => 'cn=foo,dc=foobar,dc=bar'],
'objectguid' => [0 => "\xf3\x71\xe2\x36\xa9\x48\x63\x4e\xb6\xbd\x41\xb6\x9d\x9b\x59\xb3"], // all mails should be found
]
);
self::assertEquals(['36e271f3-48a9-4e63-b6bd-41b69d9b59b3'], $userEntry->getSearchTerms());
}

public function testGetSearchTermsUnconfigured() {
$this->connection->expects($this->once())
->method('__get')
Expand Down

0 comments on commit 4b25d15

Please sign in to comment.