From 9c6cbe0f635250fddac4d7f75c24995e4bf9831d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 27 Feb 2017 16:44:20 +0100 Subject: [PATCH] Tests: Template-Objekt aus Presenter in eigenes Verzeichnis cachen lassen --- t/Support/TestSetup.pm | 20 +++++++++++++++----- t/controllers/base/render.t | 3 +-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/t/Support/TestSetup.pm b/t/Support/TestSetup.pm index 5a1e42fd1..6937b2ed2 100644 --- a/t/Support/TestSetup.pm +++ b/t/Support/TestSetup.pm @@ -34,7 +34,7 @@ sub login { 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; @@ -52,10 +52,20 @@ sub login { return 1; } -sub create_new_form { - my $form = Form->new(''); - $form->template(Template->new(template_config())) || die; - return $form; +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 { diff --git a/t/controllers/base/render.t b/t/controllers/base/render.t index 753c1cb52..b9ce240be 100644 --- a/t/controllers/base/render.t +++ b/t/controllers/base/render.t @@ -17,8 +17,7 @@ Support::TestSetup::login(); sub reset_test_env { $ENV{HTTP_USER_AGENT} = 'Perl Tests'; - $::request = SL::Request->new( - cgi => CGI->new({}), + $::request = Support::TestSetup->create_new_request( layout => SL::Layout::Javascript->new, ); -- 2.20.1