function it_should_call_the_event_dispatcher_move_events_when_moving_an_object(EventDispatcherInterface $dispatcher, $connection)
{
$operation = new RenameOperation('cn=foo,dc=foo,dc=bar', 'cn=foo', 'ou=employees,dc=foo,dc=bar');
$ldapObject = new LdapObject(['dn' => 'cn=foo,dc=foo,dc=bar', 'name' => 'foo'], 'user');
$beforeEvent = new LdapObjectMoveEvent(Event::LDAP_OBJECT_BEFORE_MOVE, $ldapObject, 'ou=employees,dc=foo,dc=bar');
$afterEvent = new LdapObjectMoveEvent(Event::LDAP_OBJECT_AFTER_MOVE, $ldapObject, 'ou=employees,dc=foo,dc=bar');
$connection->execute($operation)->willReturn(true);
$dispatcher->dispatch($beforeEvent)->shouldBeCalled();
$dispatcher->dispatch($afterEvent)->shouldBeCalled();
$this->beConstructedWith($connection, $this->objectSchemaFactory, $dispatcher);
$this->move($ldapObject, 'ou=employees,dc=foo,dc=bar');
}