Revision 4b69fb00
Von G. Richardson vor mehr als 6 Jahren hinzugefügt
t/db_helper/payment.t | ||
---|---|---|
38 | 38 |
|
39 | 39 |
my $purchase_invoice_counter = 0; # used for generating purchase invnumber |
40 | 40 |
|
41 |
Support::TestSetup::login(); |
|
42 |
|
|
43 |
# test cases: without_skonto |
|
44 |
test_default_invoice_one_item_19_without_skonto(); |
|
45 |
test_default_invoice_two_items_19_7_tax_with_skonto(); |
|
46 |
test_default_invoice_two_items_19_7_without_skonto(); |
|
47 |
test_default_invoice_two_items_19_7_without_skonto_incomplete_payment(); |
|
48 |
test_default_invoice_two_items_19_7_tax_without_skonto_multiple_payments(); |
|
49 |
test_default_purchase_invoice_two_charts_19_7_without_skonto(); |
|
50 |
test_default_purchase_invoice_two_charts_19_7_tax_partial_unrounded_payment_without_skonto(); |
|
51 |
test_default_invoice_one_item_19_without_skonto_overpaid(); |
|
52 |
test_credit_note_two_items_19_7_tax_tax_not_included(); |
|
53 |
|
|
54 |
# test cases: difference_as_skonto |
|
55 |
test_default_invoice_two_items_19_7_tax_without_skonto_multiple_payments_final_difference_as_skonto(); |
|
56 |
test_default_invoice_two_items_19_7_tax_without_skonto_multiple_payments_final_difference_as_skonto_1cent(); |
|
57 |
test_default_invoice_two_items_19_7_tax_without_skonto_multiple_payments_final_difference_as_skonto_2cent(); |
|
58 |
test_default_invoice_one_item_19_multiple_payment_final_difference_as_skonto(); |
|
59 |
test_default_invoice_one_item_19_multiple_payment_final_difference_as_skonto_1cent(); |
|
60 |
test_default_purchase_invoice_two_charts_19_7_tax_without_skonto_multiple_payments_final_difference_as_skonto(); |
|
61 |
|
|
62 |
# test cases: with_skonto_pt |
|
63 |
test_default_invoice_two_items_19_7_tax_with_skonto_50_50(); |
|
64 |
test_default_invoice_four_items_19_7_tax_with_skonto_4x_25(); |
|
65 |
test_default_invoice_four_items_19_7_tax_with_skonto_4x_25_multiple(); |
|
66 |
test_default_purchase_invoice_two_charts_19_7_with_skonto(); |
|
67 |
test_default_invoice_four_items_19_7_tax_with_skonto_4x_25_tax_included(); |
|
68 |
test_default_invoice_two_items_19_7_tax_with_skonto_tax_included(); |
|
69 |
|
|
70 |
# test payment of ar and ap transactions with currency and tax included/not included |
|
71 |
# exchangerate = 1.33333 |
|
72 |
test_ar_currency_tax_not_included_and_payment(); |
|
73 |
test_ar_currency_tax_included(); |
|
74 |
test_ap_currency_tax_not_included_and_payment(); |
|
75 |
test_ap_currency_tax_included(); |
|
76 |
|
|
77 |
test_ar_currency_tax_not_included_and_payment_2(); # exchangerate 0.8 |
|
78 |
test_ar_currency_tax_not_included_and_payment_2_credit_note(); # exchangerate 0.8 |
|
79 |
|
|
80 |
test_ap_currency_tax_not_included_and_payment_2(); # two exchangerates, with fx_gain_loss |
|
81 |
test_ap_currency_tax_not_included_and_payment_2_credit_note(); # two exchangerates, with fx_gain_loss |
|
82 |
|
|
83 |
{ local $TODO = "currently this test fails because the code writing the invoice is buggy, the calculation of skonto is correct"; |
|
84 |
my ($acc_trans_sum) = selectfirst_array_query($::form, $currency->db->dbh, 'SELECT SUM(amount) FROM acc_trans'); is($acc_trans_sum, '0.00000', "sum of all acc_trans is 0"); |
|
85 |
} |
|
86 |
|
|
87 |
# remove all created data at end of test |
|
88 |
# clear_up(); |
|
89 |
|
|
90 |
done_testing(); |
|
91 |
|
|
92 |
|
|
41 | 93 |
sub clear_up { |
42 | 94 |
SL::DB::Manager::InvoiceItem->delete_all(all => 1); |
43 | 95 |
SL::DB::Manager::Invoice->delete_all(all => 1); |
... | ... | |
1443 | 1495 |
is($total, 0, "${title}: even balance"); |
1444 | 1496 |
} |
1445 | 1497 |
|
1446 |
Support::TestSetup::login(); |
|
1447 |
|
|
1448 |
# test cases: without_skonto |
|
1449 |
test_default_invoice_one_item_19_without_skonto(); |
|
1450 |
test_default_invoice_two_items_19_7_tax_with_skonto(); |
|
1451 |
test_default_invoice_two_items_19_7_without_skonto(); |
|
1452 |
test_default_invoice_two_items_19_7_without_skonto_incomplete_payment(); |
|
1453 |
test_default_invoice_two_items_19_7_tax_without_skonto_multiple_payments(); |
|
1454 |
test_default_purchase_invoice_two_charts_19_7_without_skonto(); |
|
1455 |
test_default_purchase_invoice_two_charts_19_7_tax_partial_unrounded_payment_without_skonto(); |
|
1456 |
test_default_invoice_one_item_19_without_skonto_overpaid(); |
|
1457 |
test_credit_note_two_items_19_7_tax_tax_not_included(); |
|
1458 |
|
|
1459 |
# test cases: difference_as_skonto |
|
1460 |
test_default_invoice_two_items_19_7_tax_without_skonto_multiple_payments_final_difference_as_skonto(); |
|
1461 |
test_default_invoice_two_items_19_7_tax_without_skonto_multiple_payments_final_difference_as_skonto_1cent(); |
|
1462 |
test_default_invoice_two_items_19_7_tax_without_skonto_multiple_payments_final_difference_as_skonto_2cent(); |
|
1463 |
test_default_invoice_one_item_19_multiple_payment_final_difference_as_skonto(); |
|
1464 |
test_default_invoice_one_item_19_multiple_payment_final_difference_as_skonto_1cent(); |
|
1465 |
test_default_purchase_invoice_two_charts_19_7_tax_without_skonto_multiple_payments_final_difference_as_skonto(); |
|
1466 |
|
|
1467 |
# test cases: with_skonto_pt |
|
1468 |
test_default_invoice_two_items_19_7_tax_with_skonto_50_50(); |
|
1469 |
test_default_invoice_four_items_19_7_tax_with_skonto_4x_25(); |
|
1470 |
test_default_invoice_four_items_19_7_tax_with_skonto_4x_25_multiple(); |
|
1471 |
test_default_purchase_invoice_two_charts_19_7_with_skonto(); |
|
1472 |
test_default_invoice_four_items_19_7_tax_with_skonto_4x_25_tax_included(); |
|
1473 |
test_default_invoice_two_items_19_7_tax_with_skonto_tax_included(); |
|
1474 |
|
|
1475 |
# test payment of ar and ap transactions with currency and tax included/not included |
|
1476 |
# exchangerate = 1.33333 |
|
1477 |
test_ar_currency_tax_not_included_and_payment(); |
|
1478 |
test_ar_currency_tax_included(); |
|
1479 |
test_ap_currency_tax_not_included_and_payment(); |
|
1480 |
test_ap_currency_tax_included(); |
|
1481 |
|
|
1482 |
test_ar_currency_tax_not_included_and_payment_2(); # exchangerate 0.8 |
|
1483 |
test_ar_currency_tax_not_included_and_payment_2_credit_note(); # exchangerate 0.8 |
|
1484 |
|
|
1485 |
test_ap_currency_tax_not_included_and_payment_2(); # two exchangerates, with fx_gain_loss |
|
1486 |
test_ap_currency_tax_not_included_and_payment_2_credit_note(); # two exchangerates, with fx_gain_loss |
|
1487 |
|
|
1488 |
{ local $TODO = "currently this test fails because the code writing the invoice is buggy, the calculation of skonto is correct"; |
|
1489 |
my ($acc_trans_sum) = selectfirst_array_query($::form, $currency->db->dbh, 'SELECT SUM(amount) FROM acc_trans'); is($acc_trans_sum, '0.00000', "sum of all acc_trans is 0"); |
|
1490 |
} |
|
1491 |
|
|
1492 |
# remove all created data at end of test |
|
1493 |
clear_up(); |
|
1494 |
|
|
1495 |
done_testing(); |
|
1496 |
|
|
1497 | 1498 |
1; |
Auch abrufbar als: Unified diff
t/db_helper/payment.t - Testcode verschoben
die eigentlichen Tests stehen jetzt vor den Testfunktionen und
Helperfunktionen, nicht ganz am Ende.