t/helper/shipped_qty.t: items Sortierung stabilisiert
authorSven Schöling <s.schoeling@linet-services.de>
Mon, 31 Jul 2017 13:39:54 +0000 (15:39 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Mon, 31 Jul 2017 13:41:22 +0000 (15:41 +0200)
t/helper/shipped_qty.t

index fcddffc..b1b62a3 100644 (file)
@@ -79,8 +79,8 @@ SL::Helper::ShippedQty
   ->calculate($purchase_order)
   ->write_to_objects;
 
-is($purchase_order->orderitems->[0]->{shipped_qty}, 0, "first purchase orderitem has no shipped_qty");
-ok(!$purchase_order->orderitems->[0]->{delivered},     "first purchase orderitem is not delivered");
+is($purchase_order->items_sorted->[0]->{shipped_qty}, 0, "first purchase orderitem has no shipped_qty");
+ok(!$purchase_order->items_sorted->[0]->{delivered},     "first purchase orderitem is not delivered");
 
 my $purchase_orderitem_part1 = SL::DB::Manager::OrderItem->find_by( parts_id => $part1->id, trans_id => $purchase_order->id);
 
@@ -100,8 +100,8 @@ SL::Helper::ShippedQty
   ->calculate($purchase_order)
   ->write_to_objects;
 
-is($purchase_order->orderitems->[0]->{shipped_qty}, 11, "require_stock_out => 0: first purchase orderitem has shipped_qty");
-ok($purchase_order->orderitems->[0]->{delivered},       "require_stock_out => 0: first purchase orderitem is delivered");
+is($purchase_order->items_sorted->[0]->{shipped_qty}, 11, "require_stock_out => 0: first purchase orderitem has shipped_qty");
+ok($purchase_order->items_sorted->[0]->{delivered},       "require_stock_out => 0: first purchase orderitem is delivered");
 
 Rose::DB::Object::Helpers::forget_related($purchase_order, 'orderitems');
 $purchase_order->orderitems;
@@ -111,8 +111,8 @@ SL::Helper::ShippedQty
   ->calculate($purchase_order)
   ->write_to_objects;
 
-is($purchase_order->orderitems->[0]->{shipped_qty}, 0,  "require_stock_out => 1: first purchase orderitem has no shipped_qty");
-ok(!$purchase_order->orderitems->[0]->{delivered},      "require_stock_out => 1: first purchase orderitem is not delivered");
+is($purchase_order->items_sorted->[0]->{shipped_qty}, 0,  "require_stock_out => 1: first purchase orderitem has no shipped_qty");
+ok(!$purchase_order->items_sorted->[0]->{delivered},      "require_stock_out => 1: first purchase orderitem is not delivered");
 
 # ship items from delivery order
 SL::Dev::Inventory::transfer_purchase_delivery_order($purchase_delivery_order);
@@ -125,8 +125,8 @@ SL::Helper::ShippedQty
   ->calculate($purchase_order)
   ->write_to_objects;
 
-is($purchase_order->orderitems->[0]->{shipped_qty}, 11, "require_stock_out => 1: first purchase orderitem has shipped_qty");
-ok($purchase_order->orderitems->[0]->{delivered},       "require_stock_out => 1: first purchase orderitem is delivered");
+is($purchase_order->items_sorted->[0]->{shipped_qty}, 11, "require_stock_out => 1: first purchase orderitem has shipped_qty");
+ok($purchase_order->items_sorted->[0]->{delivered},       "require_stock_out => 1: first purchase orderitem is delivered");
 
 my $purchase_orderitem_part2 = SL::DB::Manager::OrderItem->find_by(parts_id => $part1->id, trans_id => $purchase_order->id);
 
@@ -151,8 +151,8 @@ SL::Helper::ShippedQty
   ->calculate($sales_order)
   ->write_to_objects;
 
-is($sales_order->orderitems->[0]->{shipped_qty}, 0,  "first sales orderitem has no shipped_qty");
-ok(!$sales_order->orderitems->[0]->{delivered},      "first sales orderitem is not delivered");
+is($sales_order->items_sorted->[0]->{shipped_qty}, 0,  "first sales orderitem has no shipped_qty");
+ok(!$sales_order->items_sorted->[0]->{delivered},      "first sales orderitem is not delivered");
 
 my $orderitem_part1 = SL::DB::Manager::OrderItem->find_by(parts_id => $part1->id, trans_id => $sales_order->id);
 my $orderitem_part2 = SL::DB::Manager::OrderItem->find_by(parts_id => $part2->id, trans_id => $sales_order->id);
@@ -167,8 +167,8 @@ SL::Helper::ShippedQty
   ->calculate($sales_order)
   ->write_to_objects;
 
-is($sales_order->orderitems->[0]->{shipped_qty}, 5, "require_stock_out => 0: first sales orderitem has shipped_qty");
-ok($sales_order->orderitems->[0]->{delivered},      "require_stock_out => 0: first sales orderitem is delivered");
+is($sales_order->items_sorted->[0]->{shipped_qty}, 5, "require_stock_out => 0: first sales orderitem has shipped_qty");
+ok($sales_order->items_sorted->[0]->{delivered},      "require_stock_out => 0: first sales orderitem is delivered");
 
 Rose::DB::Object::Helpers::forget_related($sales_order, 'orderitems');
 $sales_order->orderitems;
@@ -178,8 +178,8 @@ SL::Helper::ShippedQty
   ->calculate($sales_order)
   ->write_to_objects;
 
-is($sales_order->orderitems->[0]->{shipped_qty}, 0,  "require_stock_out => 1: first sales orderitem has no shipped_qty");
-ok(!$sales_order->orderitems->[0]->{delivered},      "require_stock_out => 1: first sales orderitem is not delivered");
+is($sales_order->items_sorted->[0]->{shipped_qty}, 0,  "require_stock_out => 1: first sales orderitem has no shipped_qty");
+ok(!$sales_order->items_sorted->[0]->{delivered},      "require_stock_out => 1: first sales orderitem is not delivered");
 
 # ship items from delivery order
 SL::Dev::Inventory::transfer_sales_delivery_order($sales_delivery_order);