Revision f515825d
Von Jan Büren vor mehr als 9 Jahren hinzugefügt
t/db_helper/convert_invoice.t | ||
---|---|---|
1 |
use Test::More tests => 29;
|
|
1 |
use Test::More tests => 38;
|
|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
|
... | ... | |
27 | 27 |
my ($customer, $currency_id, $buchungsgruppe, $employee, $vendor, $taxzone, $buchungsgruppe7, $tax, $tax7, |
28 | 28 |
$unit, @parts); |
29 | 29 |
|
30 |
my $VISUAL_TEST = 0; # just a sleep to click around |
|
31 |
|
|
30 | 32 |
sub clear_up { |
31 | 33 |
foreach (qw(DeliveryOrderItem DeliveryOrder InvoiceItem Invoice Part Customer Vendor Employee Department PaymentTerm)) { |
32 | 34 |
"SL::DB::Manager::${_}"->delete_all(all => 1); |
... | ... | |
218 | 220 |
# convert this do to invoice |
219 | 221 |
my $invoice = $do1->convert_to_invoice(); |
220 | 222 |
|
223 |
sleep (300) if $VISUAL_TEST; # we can do a real visual test via gui login |
|
221 | 224 |
# test invoice afterwards |
222 | 225 |
|
223 | 226 |
ok ($invoice->shipvia eq "DHL, Versand am 06.03.2015, 1 Paket 17,00 kg", "ship via check"); |
... | ... | |
285 | 288 |
|
286 | 289 |
# more ideas: check onhand, lastcost (parsed lastcost) |
287 | 290 |
|
291 |
|
|
292 |
|
|
293 |
# check linked records AND linked items |
|
294 |
|
|
295 |
# we expect something like this in record links: |
|
296 |
# delivery_order_items | 144736 | invoice | 9 | 2015-09-02 16:29:32.362562 | 5 |
|
297 |
# delivery_order_items | 144737 | invoice | 10 | 2015-09-02 16:29:32.362562 | 6 |
|
298 |
# delivery_orders | 464003 | ar | 5 | 2015-09-02 16:29:32.362562 | 7 |
|
299 |
# wir erwarten: |
|
300 |
# verkn�pfter beleg$VAR1 = { |
|
301 |
# 'from_id' => 464003, |
|
302 |
# 'from_table' => 'delivery_orders', |
|
303 |
# 'to_id' => 11, |
|
304 |
# 'to_table' => 'ar' |
|
305 |
# }; |
|
306 |
# verkn�pfte positionen$VAR1 = { |
|
307 |
# 'from_id' => 144737, |
|
308 |
# 'from_table' => 'delivery_order_items', |
|
309 |
# 'to_id' => 22, |
|
310 |
# 'to_table' => 'invoice' |
|
311 |
# }; |
|
312 |
# $VAR2 = { |
|
313 |
# 'from_id' => 144736, |
|
314 |
# 'from_table' => 'delivery_order_items', |
|
315 |
# 'to_id' => 21, |
|
316 |
# 'to_table' => 'invoice' |
|
317 |
# }; |
|
318 |
|
|
319 |
|
|
320 |
|
|
321 |
my @links_record = RecordLinks->get_links('from_table' => 'delivery_orders', |
|
322 |
'to_table' => 'ar', |
|
323 |
'from_id' => 464003); |
|
324 |
is($links_record[0]->{from_id}, '464003', "record from id check"); |
|
325 |
is($links_record[0]->{from_table}, 'delivery_orders', "record from table check"); |
|
326 |
is($links_record[0]->{to_table}, 'ar', "record to table check"); |
|
327 |
|
|
328 |
foreach (qw(144736 144737)) { |
|
329 |
my @links_record_item1 = RecordLinks->get_links('from_table' => 'delivery_order_items', |
|
330 |
'to_table' => 'invoice', |
|
331 |
'from_id' => $_); |
|
332 |
is($links_record_item1[0]->{from_id}, $_, "record from id check $_"); |
|
333 |
is($links_record_item1[0]->{from_table}, 'delivery_order_items', "record from table check $_"); |
|
334 |
is($links_record_item1[0]->{to_table}, 'invoice', "record to table check $_"); |
|
335 |
} |
|
336 |
|
|
337 |
|
|
288 | 338 |
clear_up(); |
289 | 339 |
|
290 | 340 |
1; |
Auch abrufbar als: Unified diff
convert_invoice auch LinkedRecords und Items testen