Revision d969041c
Von Jan Büren vor 12 Monaten hinzugefügt
t/wh/inventory.t | ||
---|---|---|
460 | 460 |
} |
461 | 461 |
|
462 | 462 |
|
463 |
# test DB backend function bins, bins_sorted and bins_sorted_naturally |
|
464 |
|
|
465 |
reset_db(); |
|
466 |
create_standard_stock(); |
|
467 |
|
|
468 |
$wh_moon->add_bins(SL::DB::Bin->new(description => "1A")); |
|
469 |
$wh_moon->add_bins(SL::DB::Bin->new(description => "HomeOffice")); |
|
470 |
$wh_moon->add_bins(SL::DB::Bin->new(description => "A2")); |
|
471 |
$wh_moon->add_bins(SL::DB::Bin->new(description => "Z3")); |
|
472 |
$wh_moon->add_bins(SL::DB::Bin->new(description => "a apple1")); |
|
473 |
$wh_moon->save(); |
|
474 |
|
|
475 |
$wh_moon->load(); |
|
476 |
|
|
477 |
my @bins = map { $_->description } @{ $wh_moon->bins }; # id |
|
478 |
my @bins_sorted = map { $_->description } @{ $wh_moon->bins_sorted }; # id |
|
479 |
my @bins_sorted_naturally = map { $_->description } @{ $wh_moon->bins_sorted_naturally }; # description |
|
480 |
|
|
481 |
#diag explain @bins; |
|
482 |
#diag explain @bins_sorted; |
|
483 |
#diag explain @bins_sorted_naturally; |
|
484 |
cmp_deeply(\@bins, |
|
485 |
["Lunar crater 1", "Lunar crater 2", "Lunar crater 3", "Lunar crater 4", |
|
486 |
"Lunar crater 5", "1A", "HomeOffice", "A2", "Z3", "a apple1"], |
|
487 |
"Bins for warehouse moon sorted by default (default (id))" |
|
488 |
); |
|
489 |
|
|
490 |
cmp_deeply(\@bins_sorted, |
|
491 |
["Lunar crater 1", "Lunar crater 2", "Lunar crater 3", "Lunar crater 4", |
|
492 |
"Lunar crater 5", "1A", "HomeOffice", "A2", "Z3", "a apple1"], |
|
493 |
"Bins for warehouse moon sorted by id" |
|
494 |
); |
|
495 |
|
|
496 |
cmp_deeply(\@bins_sorted_naturally, |
|
497 |
["1A", "a apple1", "A2", "HomeOffice", "Lunar crater 1", "Lunar crater 2", "Lunar crater 3", "Lunar crater 4", |
|
498 |
"Lunar crater 5", "Z3"], |
|
499 |
"Bins for warehouse moon sorted naturally" |
|
500 |
); |
|
501 |
|
|
463 | 502 |
sub reset_db { |
464 | 503 |
SL::DB::Manager::Order->delete_all(all => 1); |
465 | 504 |
SL::DB::Manager::Inventory->delete_all(all => 1); |
Auch abrufbar als: Unified diff
t:inventory Testfälle für bins_sorted und bins_sorted_naturally