X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fshop%2Fshop_order.t;h=e40ec2fcf4a6fbbf11cb8716c97d99b576c523ff;hb=43816cb7289ee9225c3bb229d077bd87a75562cc;hp=550423178405e74e58900c03c0ca8625f9c02555;hpb=c0b5a02609aedcf80741877c5ed3f61ecb94b8c8;p=kivitendo-erp.git diff --git a/t/shop/shop_order.t b/t/shop/shop_order.t index 550423178..e40ec2fcf 100644 --- a/t/shop/shop_order.t +++ b/t/shop/shop_order.t @@ -5,6 +5,7 @@ use lib 't'; use Support::TestSetup; use Carp; use Test::Exception; +use SL::DBUtils qw(check_trgm); use SL::Dev::ALL; use SL::Dev::Part qw(new_part); use SL::Dev::Shop qw(new_shop new_shop_part new_shop_order); @@ -16,12 +17,16 @@ use SL::Controller::ShopOrder; use Data::Dumper; my ($shop, $shop_order, $shop_part, $part, $customer, $employee); +my ($transdate); sub reset_state { my %params = @_; clear_up(); + $transdate = DateTime->today_local; + $transdate->set_year(2019) if $transdate->year == 2020; # use year 2019 in 2020, because of tax rate change in Germany + $shop = new_shop->save; $part = new_part->save; $shop_part = new_shop_part(part => $part, shop => $shop)->save; @@ -35,13 +40,13 @@ sub reset_state { )->save; } -sub save_shorcontroller_to_string { +sub save_shopcontroller_to_string { my $output; - open(my $outputFH, '<', \$output) or die "OUTPUT"; + open(my $outputFH, '>', \$output) or die "OUTPUT"; my $oldFH = select $outputFH; - my $shor_controller = SL::Controller::ShopOrder->new; - $shor_controller->action_transfer; + my $shop_controller = SL::Controller::ShopOrder->new; + $shop_controller->action_transfer; select $oldFH; close $outputFH; @@ -53,7 +58,7 @@ sub test_transfer { $::form->{import_id} = $params{import_id}; $::form->{customer} = $params{customer}; my $test_name = 'Test Controller Action Transfer'; - save_shorcontroller_to_string(); + save_shopcontroller_to_string(); my @links_record = RecordLinks->get_links( 'from_table' => 'shop_orders', 'from_id' => $params{import_id}, 'to_table' => 'oe', @@ -67,13 +72,15 @@ Support::TestSetup::login(); reset_state(); -my $trgm = SL::DB::ShopOrder->check_trgm; +my $trgm = check_trgm($::form->get_standard_dbh()); my $shop_trans_id = 1; $shop_order = new_shop_order( shop => $shop, + transfer_date => $transdate, shop_trans_id => $shop_trans_id, + order_date => $transdate->datetime, amount => 59.5, billing_lastname => 'Schmidt', billing_firstname => 'Sven', @@ -141,7 +148,7 @@ is($shop->description , 'testshop' , 'shop description ok'); is($shop_order->shop_id , $shop->id , "shop_id ok"); note('testing convert_to_sales_order'); -my $order = $shop_order->convert_to_sales_order(employee => $employee, customer => $customer); +my $order = $shop_order->convert_to_sales_order(employee => $employee, customer => $customer, transdate => $shop_order->order_date); $order->calculate_prices_and_taxes; $order->save;