X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fwh%2Ftransfer.t;h=8d88fb1787355a579d04ea5b505965e4c45a31fb;hb=3424bf80214aede7a8318c39b754290738e4aea0;hp=331ed506e719eb699ddc082c0c6a78dc8b4fd0a5;hpb=ed5ef25b703c78dd4bed585fe52f4d3a4ffce8d3;p=kivitendo-erp.git diff --git a/t/wh/transfer.t b/t/wh/transfer.t index 331ed506e..8d88fb178 100644 --- a/t/wh/transfer.t +++ b/t/wh/transfer.t @@ -8,10 +8,16 @@ use_ok 'SL::DB::Part'; use_ok 'SL::DB::Warehouse'; use_ok 'SL::WH'; +use_ok('SL::DB::Inventory'); + + Support::TestSetup::login(); -my $part = SL::DB::Manager::Part->get_first; -is(ref $part, 'SL::DB::Part', 'loading a part to test with id ' . $part->id); +my $part = SL::DB::Part->new(unit => 'mg', description => 'TestObject'); +$part->save(); + +is(ref($part), 'SL::DB::Part', 'loading a part to test with id ' . $part->id); + my $wh = SL::DB::Manager::Warehouse->get_first; is(ref $wh, 'SL::DB::Warehouse', 'loading a warehouse to test with id ' . $wh->id); @@ -71,6 +77,20 @@ test { shift->{qty}, shift->{qty} - 4, 'and back' } { chargenumber => '', }; +################################################# + +test {shift->{qty}, shift->{qty} + 4000000000, 'transfer one way with unit'} { + transfer_type => 'transfer', + parts_id => $part->id, + src_warehouse_id => $wh->id, + dst_warehouse_id => $wh->id, + src_bin_id => $bin1->id, + dst_bin_id => $bin2->id, + qty => 4, + unit => 't', + chargenumber => '', +}; + ############################################## use_ok 'SL::DB::TransferType'; @@ -120,6 +140,27 @@ test { shift->{qty}, shift->{qty}, 'back and forth in one transaction' } { qty => 1, }; +############################################# + +test { shift->{qty}, shift->{qty}, 'warehouse reduced interface' } { + transfer_type => SL::DB::Manager::TransferType->find_by(description => 'transfer'), + parts => $part, + src_bin => $bin2, + dst_bin => $bin1, + qty => 1, +}, +{ + transfer_type => SL::DB::Manager::TransferType->find_by(description => 'transfer'), + parts => $part, + src_bin => $bin1, + dst_bin => $bin2, + qty => 1, +}; + + +SL::DB::Manager::Inventory->delete_objects(where => [parts_id => $part->id]); + +$part->delete(); done_testing;