X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fcontrollers%2Ffinancial_overview%2Fsales_orders.t;h=abfcf7e6c85f194ddb1c20e09cf43b84a36b18e8;hb=839a165776ed0dd10a66fd936335325b40382969;hp=9b278be269aeefa33384f224e9de8c267cde4642;hpb=5534d9cb025cc4036f6fcce28a24c5e5b164641e;p=kivitendo-erp.git diff --git a/t/controllers/financial_overview/sales_orders.t b/t/controllers/financial_overview/sales_orders.t index 9b278be26..abfcf7e6c 100644 --- a/t/controllers/financial_overview/sales_orders.t +++ b/t/controllers/financial_overview/sales_orders.t @@ -37,6 +37,10 @@ Support::TestSetup::login(); our ($ar_chart, $buchungsgruppe, $ctrl, $currency_id, $customer, $employee, $order, $part, $tax_zone, $unit, @invoices); +sub clear_up { + "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"; @@ -52,7 +56,7 @@ sub create_sales_order { $params{$_} ||= {} for qw(customer part tax order orderitem); # Clean up: remove invoices, orders, parts and customers - "SL::DB::Manager::${_}"->delete_all(all => 1) for qw(InvoiceItem Invoice OrderItem Order Customer Part); + clear_up(); $customer = SL::DB::Customer->new( name => 'Test Customer', @@ -66,6 +70,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 +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; @@ -203,4 +208,6 @@ create_sales_order( is_deeply($ctrl->data->{$_}, { months => [ (0) x 12 ], quarters => [ 0, 0, 0, 0 ], year => 0 }, "periodic conf p=q ovp=y, no invoices, starting and ending before current year, data for $_") for qw(purchase_invoices purchase_orders requests_for_quotation sales_invoices sales_orders sales_orders_per_inv sales_quotations); +clear_up(); + done_testing();