5 use Support::TestSetup;
11 Support::TestSetup::login();
15 my $assortment = SL::Dev::Part::create_assortment( assnumber => 'aso1',
16 description => "Assortment 1",
17 number_of_parts => 10,
20 is( SL::DB::Manager::Part->get_all_count(), 11, "total number of parts created is 11");
22 $assortment = SL::DB::Manager::Part->find_by( partnumber => 'aso1' ) or die "Can't find assortment with partnumber aso1";
24 is($assortment->part_type, 'assortment', 'assortment has correct part_type');
25 is(scalar @{$assortment->assortment_items}, 10, 'assortment has 10 parts');
26 is($assortment->items_sellprice_sum, 100, 'assortment sellprice sum ok');
27 is($assortment->items_lastcost_sum, 50, 'assortment lastcost sum ok');
29 my $assortment_item = $assortment->assortment_items->[0];
30 is( $assortment_item->assortment->partnumber, 'aso1', "assortment_item links back to correct assortment");
36 SL::DB::Manager::AssortmentItem->delete_all(all => 1);
37 SL::DB::Manager::Part->delete_all( all => 1);