Revision 9edc6793
Von Sven Schöling vor fast 3 Jahren hinzugefügt
t/db/delivery_order.t | ||
---|---|---|
1 |
use Test::More; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use lib 't'; |
|
6 |
use utf8; |
|
7 |
|
|
8 |
use Carp; |
|
9 |
use Data::Dumper; |
|
10 |
use Support::TestSetup; |
|
11 |
use Test::Exception; |
|
12 |
|
|
13 |
use SL::DB::Order; |
|
14 |
use SL::DB::Customer; |
|
15 |
use SL::DB::Department; |
|
16 |
use SL::DB::Currency; |
|
17 |
use SL::DB::PaymentTerm; |
|
18 |
use SL::DB::DeliveryTerm; |
|
19 |
use SL::DB::Employee; |
|
20 |
use SL::DB::Part; |
|
21 |
use SL::DB::Unit; |
|
22 |
use SL::DB::DeliveryOrder; |
|
23 |
use SL::DB::DeliveryOrder::TypeData qw(:types); |
|
24 |
|
|
25 |
use SL::Dev::ALL qw(:ALL); |
|
26 |
|
|
27 |
Support::TestSetup::login(); |
|
28 |
|
|
29 |
|
|
30 |
####### |
|
31 |
|
|
32 |
my $order1 = SL::Dev::Record::create_purchase_order( |
|
33 |
save => 1, |
|
34 |
taxincluded => 0, |
|
35 |
); |
|
36 |
|
|
37 |
my $delivery_order = SL::DB::DeliveryOrder->new_from($order1); |
|
38 |
|
|
39 |
is $delivery_order->type, PURCHASE_DELIVERY_ORDER_TYPE, "new_from purchase order gives purchase delivery order"; |
|
40 |
is scalar @{ $delivery_order->items }, 2, "purchase delivery order keeps items"; |
|
41 |
is $delivery_order->vendor_id, $order1->vendor_id, "purchase delivery order keeps vendor"; |
|
42 |
|
|
43 |
my $supplier_delivery_order = SL::DB::DeliveryOrder->new_from($order1, type => SUPPLIER_DELIVERY_ORDER_TYPE); |
|
44 |
|
|
45 |
is $supplier_delivery_order->type, SUPPLIER_DELIVERY_ORDER_TYPE, "new_from purchase order with given type gives supplier delivery order"; |
|
46 |
is scalar @{ $supplier_delivery_order->items }, 0, "supplier delivery order ignores items"; |
|
47 |
is $supplier_delivery_order->vendor_id, $order1->vendor_id, "supplier delivery order keeps vendor"; |
|
48 |
|
|
49 |
done_testing(); |
Auch abrufbar als: Unified diff
DeliveryOrder: tests für new_from