Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 11200ac6

Von Werner Hahn vor mehr als 1 Jahr hinzugefügt

  • ID 11200ac6f5148fb645898719976aeef46ebe8bff
  • Vorgänger 3b181ddc
  • Nachfolger 76bfa214

HMO: DispositionManager Tests in Ornung gebracht

Unterschiede anzeigen:

t/controllers/disposition_manager/disposition_manager.t
30 30
  sellprice    => 5,
31 31
  lastcost     => 3,
32 32
  rop          => 20,
33
  ordersize    => 2,
33 34
  warehouse_id => $wh->id,
34 35
  bin_id       => $bin->id,
35 36
  makemodels   => [ _create_makemodel_for_vendor(vendor => $vendor) ],
......
39 40
  partnumber   => 'TP 2',
40 41
  description  => 'Testpart 2 norop',
41 42
  rop          => 60,
43
  ordersize    => 2,
42 44
)->save;
43 45
set_stock(part => $part2, bin_id => $bin->id, qty => 80);
44 46

  
......
47 49
    partnumber   => "TPO $i",
48 50
    description  => "Testpart onhand $i",
49 51
    rop          => 50,
52
    ordersize    => 2,
50 53
    sellprice    => 5,
51 54
    lastcost     => 3,
52 55
    warehouse_id => $wh->id,
......
84 87
$::form->{ids}        = [ map { $_->id       } @{ $purchase_basket_items } ];
85 88
$::form->{vendor_ids} = [ map { $vendor->id  } @{ $purchase_basket_items } ];
86 89

  
90
$output;
91
open(my $outputFH, '>', \$output) or die;
92
$oldFH = select $outputFH;
87 93
$controller->action_transfer_to_purchase_order;
94
select $oldFH;
95
close $outputFH;
88 96

  
89 97
is(SL::DB::Manager::Order->get_all_count( where => [ SL::DB::Manager::Order->type_filter('purchase_order') ] ), 1, "1 purchase order created ok");
90 98
is(SL::DB::Manager::PurchaseBasketItem->get_all_count(), 0, "purchase basket empty after purchase order was created");
......
94 102
is( scalar @{$purchase_order->items}, 6, "Purchase order has 6 item ok");
95 103
my $first_item = $purchase_order->items_sorted->[0];
96 104
is( $first_item->parts_id, $part1->id, "Purchase order: first item is part1");
97
is( $first_item->qty, 1, "Purchase order: first item has qty 1");
98
cmp_ok( $purchase_order->netamount, '==', 12, "Purchase order: netamount ok");
99
is( $first_item->active_price_source, 'makemodel/' . $first_item->part->makemodels->[0]->id, "Purchase order: first item has correct active_price_source");
105
is( $first_item->qty, '2.0000000', "Purchase order: first item has qty 2");
106
cmp_ok( $purchase_order->netamount, '==', 24, "Purchase order: netamount ok");
107
is( $first_item->active_price_source, 'makemodel/' . $part1->makemodels->[0]->id . "/" . $part1->makemodels->[0]->parts_id . "/" . $part1->makemodels->[0]->make, "Purchase order: first item has correct active_price_source");
100 108

  
109
clear_up();
101 110
done_testing();
102
# clear_up();
103 111

  
104 112
sub clear_up {
105 113
  my %params = @_;
......
121 129

  
122 130
  my $mm = SL::DB::MakeModel->new(make          => $vendor->id,
123 131
                                  model         => '',
124
                                  min_order_qty => '1',
125 132
                                  lastcost      => 2,
126 133
                                  sortorder     => 1,
127 134
                                 );

Auch abrufbar als: Unified diff