Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision de8da5ba

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID de8da5ba5ece7f68cf008b88016b42925e840100
  • Vorgänger 0f2a7ae0
  • Nachfolger 1181d2b6

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.

Unterschiede anzeigen:

t/000setup_database.t
14 14
use SL::LXDebug;
15 15
use SL::Layout::None;
16 16
use SL::LxOfficeConf;
17
use Support::TestSetup;
17 18

  
18 19
our ($db_cfg, $dbh);
19 20

  
......
51 52
  $::lxdebug       = LXDebug->new(target => LXDebug::STDERR_TARGET);
52 53
  $::lxdebug->disable_sub_tracing;
53 54
  $::locale        = Locale->new($::lx_office_conf{system}->{language});
54
  $::form          = Form->new;
55
  $::form          = Support::TestSetup->create_new_form;
55 56
  $::auth          = SL::Auth->new(unit_tests_database => 1);
56 57
  $::locale        = Locale->new('de');
57 58
  $::instance_conf = SL::InstanceConfiguration->new;
t/Support/TestSetup.pm
29 29
  $::lxdebug       = LXDebug->new(target => LXDebug::STDERR_TARGET);
30 30
  $::lxdebug->disable_sub_tracing;
31 31
  $::locale        = Locale->new($::lx_office_conf{system}->{language});
32
  $::form          = Form->new;
32
  $::form          = Support::TestSetup->create_new_form;
33 33
  $::auth          = SL::Auth->new(unit_tests_database => 1);
34 34
  die "Cannot find client with ID or name '$client'" if !$::auth->set_client($client);
35 35

  
......
48 48

  
49 49
  $SIG{__DIE__} = sub { Carp::confess( @_ ) } if $::lx_office_conf{debug}->{backtrace_on_die};
50 50

  
51
  Support::TestSetup::create_form_template_provider();
52 51

  
53 52
  return 1;
54 53
}
55 54

  
56
sub create_form_template_provider {
57
  $::form->template(Template->new(template_config())) || die;
55
sub create_new_form {
56
  my $form = Form->new('');
57
  $form->template(Template->new(template_config())) || die;
58
  return $form;
58 59
}
59 60

  
60 61
sub template_config {
t/controllers/financial_controlling/sales_order_with_periodic_invoices_config.t
101 101

  
102 102
  ok($order->save(cascade => 1));
103 103

  
104
  $::form = Form->new('');
104
  $::form = Support::TestSetup->create_new_form;
105 105
  $ctrl   = SL::Controller::FinancialControllingReport->new;
106 106

  
107 107
  $ctrl->orders($ctrl->models->get);
t/controllers/financial_overview/sales_orders.t
105 105

  
106 106
  ok($order->save(cascade => 1));
107 107

  
108
  $::form         = Form->new('');
108
  $::form         = Support::TestSetup->create_new_form;
109 109
  $::form->{year} = 2014;
110 110
  $ctrl           = SL::Controller::FinancialOverview->new;
111 111

  

Auch abrufbar als: Unified diff