function it_should_error_when_calling_getRepository_for_a_type_that_does_not_exist() { $this->config->setSchemaFolder(__DIR__ . '/../resources/schema'); $this->domain->setSchemaName('example'); $this->beConstructedWith($this->config); $this->shouldThrow(new \RuntimeException('Unable to load Repository for type "foo": Cannot find object type "foo" in schema.'))->duringGetRepository('foo'); $this->shouldThrow(new \RuntimeException('Unable to load Repository for type "user": Repository class "\\Foo\\Bar" not found.'))->duringGetRepository('user'); }
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(); }