Revision 304a3439
Von Bernd Bleßmann vor fast 2 Jahren hinzugefügt
t/wh/inventory.t | ||
---|---|---|
218 | 218 |
); |
219 | 219 |
}, "producing for wrong warehouse dies"); |
220 | 220 |
|
221 |
# same test, but check exception class |
|
221 |
# same test, but check exception class and error messages
|
|
222 | 222 |
throws_ok{ |
223 | 223 |
SL::Helper::Inventory::produce_assembly( |
224 | 224 |
part => $assembly1, |
... | ... | |
228 | 228 |
bin => $bin_moon, |
229 | 229 |
chargenumber => "Lunar Dust inside", |
230 | 230 |
); |
231 |
} "SL::X::Inventory::Allocation", "producing for wrong warehouse throws correct error class"; |
|
232 |
|
|
233 |
# same test, but check user feedback for the error message |
|
234 |
throws_ok{ |
|
235 |
SL::Helper::Inventory::produce_assembly( |
|
236 |
part => $assembly1, |
|
237 |
qty => 1, |
|
238 |
auto_allocate => 1, |
|
239 |
# where to put it |
|
240 |
bin => $bin_moon, |
|
241 |
chargenumber => "Lunar Dust inside", |
|
242 |
); |
|
243 |
} qr/Part ap (1|2) Testpart (1|2) exists in warehouse Warehouse, but not in warehouse Our warehouse location at the moon/, "producing for wrong warehouse throws correct error message"; |
|
231 |
} "SL::X::Inventory::Allocation::Multi", "producing for wrong warehouse throws correct error class"; |
|
232 |
my $e = $@; |
|
233 |
like $e, qr/multiple errors during allocation/, "producing for wrong warehouse throws correct error message for multiple errors"; |
|
234 |
like $e->errors->[0]->message, qr/Part ap (1|2) Testpart (1|2) exists in warehouse Warehouse, but not in warehouse Our warehouse location at the moon/, |
|
235 |
"producing for wrong warehouse throws correct error message"; |
|
244 | 236 |
|
245 | 237 |
# try to produce without allocations dies |
246 | 238 |
|
... | ... | |
351 | 343 |
# where to put it |
352 | 344 |
bin => $bin1, |
353 | 345 |
); |
354 |
} qr/can not allocate 1,2 units of service number 1 We really need this service, missing 1,2 units/, "producing assembly with services and unstocked service throws correct error message"; |
|
346 |
} "SL::X::Inventory::Allocation::Multi", "producing assembly with services and unstocked service throws correct error class"; |
|
347 |
$e = $@; |
|
348 |
like $e, qr/multiple errors during allocation/, "producing assembly with services and unstocked service throws correct error message for multiple errors"; |
|
349 |
like $e->errors->[0]->message, qr/can not allocate 1,2 units of service number 1 We really need this service, missing 1,2 units/, |
|
350 |
"producing assembly with services and unstocked service throws correct error message"; |
|
355 | 351 |
|
356 | 352 |
is(SL::Helper::Inventory::get_stock(part => $assembly_service), "1.00000", 'produce without service does not work'); |
357 | 353 |
is(SL::Helper::Inventory::get_stock(part => $part1), "12.00000", 'and does not consume...'); |
Auch abrufbar als: Unified diff
Unit-Tests refixed
nach "Erzeugnis fertigen: alle möglichen Allokationsfehler auf einmal anzeigen"
(cherry picked from commit bad5876e62b3b5345c3e3e8e05ae63e93dde50f1)