spec\LdapTools\Object\LdapObjectCreatorSpec::it_should_call_creation_events_when_creating_a_ldap_object PHP Метод

it_should_call_creation_events_when_creating_a_ldap_object() публичный Метод

public it_should_call_creation_events_when_creating_a_ldap_object ( LdapTools\Event\EventDispatcherInterface $dispatcher, $connection )
$dispatcher LdapTools\Event\EventDispatcherInterface
    function it_should_call_creation_events_when_creating_a_ldap_object(EventDispatcherInterface $dispatcher, $connection)
    {
        $this->addOperation->setLocation('dc=foo,dc=bar');
        $connection->execute($this->addOperation)->willReturn(true);
        $beforeEvent = new LdapObjectCreationEvent(Event::LDAP_OBJECT_BEFORE_CREATE);
        $beforeEvent->setContainer('dc=foo,dc=bar');
        $beforeEvent->setData(['username' => '%foo%', 'password' => '%bar%']);
        $beforeEvent->setDn('');
        $afterEvent = new LdapObjectCreationEvent(Event::LDAP_OBJECT_AFTER_CREATE);
        $afterEvent->setContainer('dc=foo,dc=bar');
        $afterEvent->setData(['username' => 'somedude', 'password' => '12345']);
        $afterEvent->setDn('cn=somedude,dc=foo,dc=bar');
        $dispatcher->dispatch($beforeEvent)->shouldBeCalled();
        $dispatcher->dispatch($afterEvent)->shouldBeCalled();
        $this->config->setSchemaName('ad');
        $this->beConstructedWith($connection, $this->schemaFactory, $dispatcher);
        $this->createUser()->with(['username' => '%foo%', 'password' => '%bar%'])->in('dc=foo,dc=bar')->setParameter('foo', 'somedude')->setParameter('bar', '12345');
        $this->execute();
    }