function it_should_call_the_event_dispatcher_delete_events_when_deleting_an_object(EventDispatcherInterface $dispatcher, $connection)
{
$ldapObject = new LdapObject(['dn' => 'cn=foo,dc=foo,dc=bar'], 'user');
$beforeEvent = new LdapObjectEvent(Event::LDAP_OBJECT_BEFORE_DELETE, $ldapObject);
$afterEvent = new LdapObjectEvent(Event::LDAP_OBJECT_AFTER_DELETE, $ldapObject);
$connection->execute(new DeleteOperation('cn=foo,dc=foo,dc=bar'))->willReturn(true);
$dispatcher->dispatch($beforeEvent)->shouldBeCalled();
$dispatcher->dispatch($afterEvent)->shouldBeCalled();
$this->beConstructedWith($connection, $this->objectSchemaFactory, $dispatcher);
$this->delete($ldapObject);
}