Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5222d83a

Von Kivitendo Admin vor mehr als 8 Jahren hinzugefügt

  • ID 5222d83a988103d78a2dd32b11ca2e1306a156f9
  • Vorgänger 10348b51
  • Nachfolger d780abd1

Test für Erzeugnisse per Rose erstellen erweitert

Unterschiede anzeigen:

t/part/assembly.t
13 13
clear_up();
14 14
reset_state();
15 15

  
16
is( SL::DB::Manager::Part->get_all_count(), 3,  "total number of parts created is 2");
16
is( SL::DB::Manager::Part->get_all_count(), 3,  "total number of parts created is 3");
17 17

  
18
my $assembly = SL::DB::Manager::Part->find_by( partnumber => 'as1' );
18
my $assembly_part      = SL::DB::Manager::Part->find_by( partnumber => 'as1' );
19
my $assembly_item_part = SL::DB::Manager::Part->find_by( partnumber => '19000' );
19 20

  
20
is($assembly->type, 'assembly', 'assembly has correct type');
21
is( scalar @{$assembly->assemblies}, 2, 'assembly consists of two parts' );
21
is($assembly_part->inventory_accno_id, undef, "assembly doesn't have an inventory accno id");
22

  
23
is($assembly_part->type, 'assembly', 'assembly has correct type');
24
is( scalar @{$assembly_part->assemblies}, 2, 'assembly consists of two parts' );
25

  
26
# fetch assembly item corresponding to partnumber 19000
27
my $assembly_items = $assembly_part->find_assemblies( { parts_id => $assembly_item_part->id } ) || die "can't find assembly_item";
28
my $assembly_item = $assembly_items->[0];
29
is($assembly_item->part->partnumber, '19000', 'assembly part part relation works');
30
is($assembly_item->assembly_part->partnumber, 'as1', 'assembly part assembly part relation works');
22 31

  
23 32
clear_up();
24 33
done_testing;
......
42 51
  $part2->partnumber($part1->partnumber + 1);
43 52
  $part2->save;
44 53

  
45
  my $assembly_part = SL::DB::Part->new_assembly(partnumber  => 'as1',
46
                                                 description => 'assembly',
47
                                                 unit        => $unit->name,
54
  my $assembly_part = SL::DB::Part->new_assembly(partnumber         => 'as1',
55
                                                 description        => 'assembly',
56
                                                 unit               => $unit->name,
57
                                                 inventory_accno_id => undef, # override
48 58
                                                );
49
  my $assembly_1 = SL::DB::Assembly->new(parts_id => $part2->id, qty => 3, bom => 1);
59
  my $assembly_1 = SL::DB::Assembly->new(parts_id => $part1->id, qty => 3, bom => 1);
50 60
  my $assembly_2 = SL::DB::Assembly->new(parts_id => $part2->id, qty => 3, bom => 1);
51 61
  $assembly_part->add_assemblies($assembly_1, $assembly_2);
52 62
  $assembly_part->save;

Auch abrufbar als: Unified diff