mini-DMS: Filesystem-Backend: ungeänderte Dokumente nicht doppelt speichern.
[kivitendo-erp.git] / t / Support / TestSetup.pm
index 2894cbb..6937b2e 100644 (file)
@@ -29,12 +29,12 @@ sub login {
   $::lxdebug       = LXDebug->new(target => LXDebug::STDERR_TARGET);
   $::lxdebug->disable_sub_tracing;
   $::locale        = Locale->new($::lx_office_conf{system}->{language});
-  $::form          = Form->new;
+  $::form          = Support::TestSetup->create_new_form;
   $::auth          = SL::Auth->new(unit_tests_database => 1);
   die "Cannot find client with ID or name '$client'" if !$::auth->set_client($client);
 
   $::instance_conf = SL::InstanceConfiguration->new;
-  $::request       = SL::Request->new( cgi => CGI->new({}), layout => SL::Layout::None->new );
+  $::request       = Support::TestSetup->create_new_request;
 
   die 'cannot reach auth db'               unless $::auth->session_tables_present;
 
@@ -48,13 +48,24 @@ sub login {
 
   $SIG{__DIE__} = sub { Carp::confess( @_ ) } if $::lx_office_conf{debug}->{backtrace_on_die};
 
-  Support::TestSetup::create_form_template_provider();
 
   return 1;
 }
 
-sub create_form_template_provider {
-  $::form->template(Template->new(template_config())) || die;
+sub create_new_form { Form->new('') }
+
+sub create_new_request {
+  my $self = shift;
+
+  my $request = SL::Request->new(
+    cgi    => CGI->new({}),
+    layout => SL::Layout::None->new,
+    @_,
+  );
+
+  $request->presenter->{template} = Template->new(template_config()) || die;
+
+  return $request;
 }
 
 sub template_config {