X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fcontrollers%2Ffinancial_controlling%2Fsales_order_with_periodic_invoices_config.t;h=8541cb7be891b8795b70b67a115157146cc1805c;hb=543b7743647b029defd1584cfc8f021edb7a4634;hp=1dab1e8f0708d3ec18feaf4a4365ccc4bbeffdd8;hpb=9c79e857f11b18b05c34189c26901fad86bc22ba;p=kivitendo-erp.git 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 1dab1e8f0..8541cb7be 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 @@ -37,6 +37,10 @@ Support::TestSetup::login(); our ($ar_chart, $buchungsgruppe, $ctrl, $currency_id, $customer, $employee, $order, $part, $tax_zone, $unit, @invoices); +sub cleanup { + "SL::DB::Manager::${_}"->delete_all(all => 1) for qw(InvoiceItem Invoice OrderItem Order Customer Part); +} + sub init_common_state { $ar_chart = SL::DB::Manager::Chart->find_by(accno => '1400') || croak "No AR chart"; $buchungsgruppe = SL::DB::Manager::Buchungsgruppe->find_by(description => 'Standard 19%') || croak "No accounting group"; @@ -49,10 +53,9 @@ sub init_common_state { sub create_sales_order { my %params = @_; - $params{$_} ||= {} for qw(customer part tax order orderitem); + cleanup(); - # Clean up: remove invoices, orders, parts and customers - "SL::DB::Manager::${_}"->delete_all(all => 1) for qw(InvoiceItem Invoice OrderItem Order Customer Part); + $params{$_} ||= {} for qw(customer part tax order orderitem); $customer = SL::DB::Customer->new( name => 'Test Customer', @@ -66,6 +69,7 @@ sub create_sales_order { description => 'Fourty-two fifty-four', lastcost => 222.22, sellprice => 333.33, + part_type => 'part', buchungsgruppen_id => $buchungsgruppe->id, unit => $unit->name, %{ $params{part} } @@ -100,7 +104,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); @@ -544,5 +548,6 @@ run_tests( end_date => DateTime->from_kivitendo('30.04.2014'), }); +cleanup(); done_testing();