Skip to content
Snippets Groups Projects
Unverified Commit ba91d2e5 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Add more tests

parent 25161d33
No related branches found
No related tags found
No related merge requests found
...@@ -15,20 +15,11 @@ class DummyLDAPApiProvider implements LDAPApiProviderInterface ...@@ -15,20 +15,11 @@ class DummyLDAPApiProvider implements LDAPApiProviderInterface
*/ */
public function personFromUserItemPostHook(array $attributes, Person $person, bool $full = false) public function personFromUserItemPostHook(array $attributes, Person $person, bool $full = false)
{ {
// For example, you can parse the date of birth from the LDAP attribute and set it to the person object. $person->setExtraData('test', 'my-test-string');
// $birthDate = $attributes['dateofbirth'][0];
// $person->setBirthDate($birthDate);
} }
public function getPersonForExternalServiceHook(string $service, string $serviceID): Person public function getPersonForExternalServiceHook(string $service, string $serviceID): Person
{ {
// For example, you can use the service and serviceID to get the person from some other service.
// if ($service === 'SOME-SERVICE') {
// return getPersonFromSomeService($serviceID);
// }
throw new BadRequestHttpException("Unknown service: $service"); throw new BadRequestHttpException("Unknown service: $service");
} }
} }
...@@ -83,4 +83,15 @@ class PersonTest extends ApiTestCase ...@@ -83,4 +83,15 @@ class PersonTest extends ApiTestCase
$this->assertEquals('1994-06-24', $person->getBirthDate()); $this->assertEquals('1994-06-24', $person->getBirthDate());
} }
} }
public function testLDAPApiProvider()
{
$user = new AdldapUser([
'cn' => ['foobar'],
], $this->newBuilder());
$person = $this->api->personFromUserItem($user, false);
$this->assertEquals($person->getExtraData('test'), 'my-test-string');
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment