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

Prepare PersonUserItemPreEvent test (not finished, needs more mocking)

parent d6b8a219
Branches
Tags v0.2.0
No related merge requests found
Pipeline #85027 passed with warnings
<?php
declare(strict_types=1);
namespace Dbp\Relay\BasePersonConnectorLdapBundle\TestUtils;
use Dbp\Relay\BasePersonConnectorLdapBundle\Event\PersonUserItemPreEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class PersonUserItemSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return [
PersonUserItemPreEvent::NAME => 'onPre',
];
}
public function onPre(PersonUserItemPreEvent $event)
{
$identifier = $event->getIdentifier();
$event->setIdentifier($identifier);
}
}
......@@ -13,6 +13,7 @@ use Dbp\Relay\BasePersonConnectorLdapBundle\Service\LDAPApi;
use Dbp\Relay\BasePersonConnectorLdapBundle\Service\LDAPPersonProvider;
use Dbp\Relay\BasePersonConnectorLdapBundle\TestUtils\PersonForExternalServiceSubscriber;
use Dbp\Relay\BasePersonConnectorLdapBundle\TestUtils\PersonFromUserItemSubscriber;
use Dbp\Relay\BasePersonConnectorLdapBundle\TestUtils\PersonUserItemSubscriber;
use Mockery;
use Symfony\Component\EventDispatcher\EventDispatcher;
......@@ -33,9 +34,11 @@ class PersonTest extends ApiTestCase
parent::setUp();
$personFromUserItemSubscriber = new PersonFromUserItemSubscriber();
$personForExternalServiceSubscriber = new PersonForExternalServiceSubscriber();
$personUserItemSubscriber = new PersonUserItemSubscriber();
$eventDispatcher = new EventDispatcher();
$eventDispatcher->addSubscriber($personFromUserItemSubscriber);
$eventDispatcher->addSubscriber($personForExternalServiceSubscriber);
$eventDispatcher->addSubscriber($personUserItemSubscriber);
$this->api = new LDAPApi(self::createClient()->getContainer(), $eventDispatcher);
$this->api->setConfig([
......@@ -124,4 +127,11 @@ class PersonTest extends ApiTestCase
$this->assertEquals($person->getExtraData('test-service'), 'my-test-service-string-17');
}
// public function testPersonUserItemEvent()
// {
// $user = $this->api->getPersonUserItem('foobar');
//
// $this->assertEquals($user->getName(), 'foobar');
// }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment