Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4a852cb1

Von Jan Büren vor mehr als 3 Jahren hinzugefügt

  • ID 4a852cb1ba0225e6e086786d3950fc7a3c068f38
  • Vorgänger 3e1190f9
  • Nachfolger 1f7b2604

Testfall: Erzeugnis fertigen aufm Mond, aber Einzelteile im Lager Erde

Unterschiede anzeigen:

t/wh/inventory.t
19 19

  
20 20
Support::TestSetup::login();
21 21

  
22
my ($wh, $bin1, $bin2, $assembly1, $part1, $part2);
22
my ($wh, $bin1, $bin2, $assembly1, $part1, $part2, $wh_moon, $bin_moon);
23 23

  
24 24
reset_db();
25 25
create_standard_stock();
......
150 150

  
151 151
# produce the same using auto_allocation
152 152

  
153
local $::locale = Locale->new('en');
153 154
reset_db();
154 155
create_standard_stock();
155 156

  
......
209 210

  
210 211

  
211 212

  
213
# try to produce something for our lunar warehouse, but parts are only available on earth
214
dies_ok(sub {
215
SL::Helper::Inventory::produce_assembly(
216
  part          => $assembly1,
217
  qty           => 1,
218
  auto_allocate => 1,
219
  # where to put it
220
  bin          => $bin_moon,
221
  chargenumber => "Lunar Dust inside",
222
);
223
}, "producing for wrong warehouse dies");
224

  
225
# same test, but check exception class
226
throws_ok{
227
SL::Helper::Inventory::produce_assembly(
228
  part          => $assembly1,
229
  qty           => 1,
230
  auto_allocate => 1,
231
  # where to put it
232
  bin          => $bin_moon,
233
  chargenumber => "Lunar Dust inside",
234
);
235
 } "SL::X::Inventory::Allocation", "producing for wrong warehouse throws correct error class";
236

  
237
# same test, but check user feedback for the error message
238
throws_ok{
239
SL::Helper::Inventory::produce_assembly(
240
  part          => $assembly1,
241
  qty           => 1,
242
  auto_allocate => 1,
243
  # where to put it
244
  bin          => $bin_moon,
245
  chargenumber => "Lunar Dust inside",
246
);
247
 } 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";
248

  
212 249
# try to produce without allocations dies
213 250

  
214 251
dies_ok(sub {
......
301 338
}
302 339

  
303 340
sub create_standard_stock {
304
  ($wh, $bin1) = create_warehouse_and_bins();
341
  ($wh, $bin1)          = create_warehouse_and_bins();
342
  ($wh_moon, $bin_moon) = create_warehouse_and_bins(
343
      warehouse_description => 'Our warehouse location at the moon',
344
      bin_description       => 'Lunar crater',
345
    );
305 346
  $bin2 = SL::DB::Bin->new(description => "Bin 2", warehouse => $wh)->save;
306 347
  $wh->load;
307 348

  

Auch abrufbar als: Unified diff