From: Moritz Bunkus Date: Fri, 10 Feb 2017 15:09:13 +0000 (+0100) Subject: Tests: $::form nur über Helfermethode Support::TestSetup::create_new_form anlege X-Git-Tag: release-3.5.4~1492 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=de8da5ba5ece7f68cf008b88016b42925e840100;p=kivitendo-erp.git Tests: $::form nur über Helfermethode Support::TestSetup::create_new_form anlege Diese Helfermethode erstellt und konfiguriert auch gleich das Template-Objekt mit dem Pfad zum Test-eigenen Template-Cache-Verzeichnis. --- diff --git a/t/000setup_database.t b/t/000setup_database.t index e5031d1f9..f61c8a3c1 100755 --- a/t/000setup_database.t +++ b/t/000setup_database.t @@ -14,6 +14,7 @@ use SL::InstanceConfiguration; use SL::LXDebug; use SL::Layout::None; use SL::LxOfficeConf; +use Support::TestSetup; our ($db_cfg, $dbh); @@ -51,7 +52,7 @@ sub setup { $::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); $::locale = Locale->new('de'); $::instance_conf = SL::InstanceConfiguration->new; diff --git a/t/Support/TestSetup.pm b/t/Support/TestSetup.pm index 2894cbb2f..5a1e42fd1 100644 --- a/t/Support/TestSetup.pm +++ b/t/Support/TestSetup.pm @@ -29,7 +29,7 @@ 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); @@ -48,13 +48,14 @@ 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 { + my $form = Form->new(''); + $form->template(Template->new(template_config())) || die; + return $form; } sub template_config { diff --git a/t/controllers/financial_controlling/sales_order_with_periodic_invoices_config.t b/t/controllers/financial_controlling/sales_order_with_periodic_invoices_config.t index 943666d85..30cf32386 100644 --- a/t/controllers/financial_controlling/sales_order_with_periodic_invoices_config.t +++ b/t/controllers/financial_controlling/sales_order_with_periodic_invoices_config.t @@ -101,7 +101,7 @@ sub create_sales_order { ok($order->save(cascade => 1)); - $::form = Form->new(''); + $::form = Support::TestSetup->create_new_form; $ctrl = SL::Controller::FinancialControllingReport->new; $ctrl->orders($ctrl->models->get); diff --git a/t/controllers/financial_overview/sales_orders.t b/t/controllers/financial_overview/sales_orders.t index cfa4ad5cd..abfcf7e6c 100644 --- a/t/controllers/financial_overview/sales_orders.t +++ b/t/controllers/financial_overview/sales_orders.t @@ -105,7 +105,7 @@ sub create_sales_order { ok($order->save(cascade => 1)); - $::form = Form->new(''); + $::form = Support::TestSetup->create_new_form; $::form->{year} = 2014; $ctrl = SL::Controller::FinancialOverview->new;