function it_should_call_the_event_dispatcher_restore_events_when_restoring_an_object(EventDispatcherInterface $dispatcher, $connection)
{
$dn = 'cn=foo\\0ADEL:0101011,cn=Deleted Objects,dc=example,dc=local';
$ldapObject = new LdapObject(['dn' => $dn, 'lastKnownLocation' => 'cn=Users,dc=example,dc=local'], 'deleted');
$beforeEvent = new LdapObjectRestoreEvent(Event::LDAP_OBJECT_BEFORE_RESTORE, $ldapObject, 'ou=employees,dc=foo,dc=bar');
$afterEvent = new LdapObjectRestoreEvent(Event::LDAP_OBJECT_AFTER_RESTORE, $ldapObject, 'ou=employees,dc=foo,dc=bar');
$connection->execute(Argument::type('\\LdapTools\\Operation\\BatchModifyOperation'))->willReturn(true);
$dispatcher->dispatch($beforeEvent)->shouldBeCalled();
$dispatcher->dispatch($afterEvent)->shouldBeCalled();
$this->beConstructedWith($connection, $this->objectSchemaFactory, $dispatcher);
$this->restore($ldapObject, 'ou=employees,dc=foo,dc=bar');
}