summaryrefslogtreecommitdiff
path: root/t/data/62-request-data
blob: bb5e77476fac26690cb01b5350ad1a860b964759 (plain)
  1. use Test::More;
  2. our $test_request_data = [
  3. # AR/AP Transaction Screen Tests
  4. {
  5. '_test_id' => 'AR Transaction Screen',
  6. '_codebase' => 'old',
  7. 'module' => 'ar.pl',
  8. 'action' => 'add'
  9. },
  10. {
  11. '_test_id' => 'AP Transaction Screen',
  12. '_codebase' => 'old',
  13. 'module' => 'ap.pl',
  14. 'action' => 'add'
  15. },
  16. # Create Batch Screens
  17. {
  18. '_test_id' => 'AR Transaction Voucher Screen',
  19. '_codebase' => 'new',
  20. 'action' => 'create_batch',
  21. 'batch_type' => 'recievable',
  22. 'module' => 'vouchers.pl',
  23. },
  24. {
  25. '_test_id' => 'AP Transaction Voucher Screen',
  26. '_codebase' => 'new',
  27. 'action' => 'create_batch',
  28. 'batch_type' => 'payable',
  29. 'module' => 'vouchers.pl',
  30. },
  31. {
  32. '_test_id' => 'Payment Transaction Voucher Screen',
  33. '_codebase' => 'new',
  34. 'action' => 'create_batch',
  35. 'batch_type' => 'payment',
  36. 'module' => 'vouchers.pl',
  37. },
  38. {
  39. '_test_id' => 'Payment Reversal Transaction Voucher Screen',
  40. '_codebase' => 'new',
  41. 'action' => 'create_batch',
  42. 'batch_type' => 'payment_reversal',
  43. 'module' => 'vouchers.pl',
  44. },
  45. {
  46. '_test_id' => 'GL Transaction Voucher Screen',
  47. '_codebase' => 'new',
  48. 'action' => 'create_batch',
  49. 'batch_type' => 'gl',
  50. 'module' => 'vouchers.pl',
  51. },
  52. {
  53. '_test_id' => 'Payment print total',
  54. '_codebase' => 'new',
  55. 'action' => 'print',
  56. 'approved' => 0,
  57. 'currency' => 'USD',
  58. 'datepaid' => '2008-07-22',
  59. 'contact_1' => '25',
  60. 'id_25' => '25',
  61. 'paid_25' => 'all',
  62. 'payment_209' => '1000.00',
  63. 'invoice_25_1' => 209,
  64. 'net_209' => '1000.00',
  65. 'payment_210' => '-100.00',
  66. 'invoice_25_2' => '210',
  67. 'net_210' => '-100.00',
  68. 'payment_344' => '100000.00',
  69. 'invoice_25_3' => '344',
  70. 'net_344' => '100000.00',
  71. 'payment_352' => '1000.00',
  72. 'invoice_25_4' => '352',
  73. 'net_352' => '1000.00',
  74. 'payment_353' => '1000.00',
  75. 'invoice_25_5' => '353',
  76. 'net_353' => '1000.00',
  77. 'payment_354' => '1000.00',
  78. 'invoice_25_6' => '354',
  79. 'net_354' => '1000.00',
  80. 'payment_355' => '1000.00',
  81. 'invoice_25_7' => '355',
  82. 'net_355' => '1000.00',
  83. 'payment_356' => '1000.00',
  84. 'invoice_25_8' => '356',
  85. 'net_356' => '1000.00',
  86. 'invoice_count_25' => 8,
  87. 'contact_count' => 1,
  88. 'media' => 'screen',
  89. 'format' => 'PDF',
  90. 'module' => 'payment.pl',
  91. 'account_class' => 1,
  92. 'currency' => 'USD',
  93. 'multiple' => 1,
  94. },
  95. ];
  96. our $pre_test_subs = {
  97. 'Payment print total' => sub {
  98. $LedgerSMB::Sysconfig::check_max_invoices = 1;
  99. },
  100. };
  101. our $api_test_cases = {
  102. 'AR Transaction Voucher Screen' => sub {
  103. my $request = shift;
  104. ok($request->{batch_number}, 'Batch Number is Defined');
  105. },
  106. 'AP Transaction Voucher Screen' => sub {
  107. my $request = shift;
  108. ok($request->{batch_number}, 'Batch Number is Defined');
  109. },
  110. 'Payment Transaction Voucher Screen' => sub {
  111. my $request = shift;
  112. ok($request->{batch_number}, 'Batch Number is Defined');
  113. },
  114. 'Payment Reversal Transaction Voucher Screen' => sub {
  115. my $request = shift;
  116. ok($request->{batch_number}, 'Batch Number is Defined');
  117. },
  118. 'GL Transaction Voucher Screen' => sub {
  119. my $request = shift;
  120. ok($request->{batch_number}, 'Batch Number is Defined');
  121. },
  122. 'Payment print total' => sub {
  123. use strict;
  124. my $request = shift;
  125. $request->debug({file => '/tmp/check' });
  126. cmp_ok($request->{invoice_count_25}, '>', $LedgerSMB::Sysconfig::check_max_invoices, 'Test is valid under current config');
  127. cmp_ok(scalar @{$request->{checks}}, '==',
  128. $request->{contact_count},
  129. 'Correct number of checks printed');
  130. my $check = shift @{$request->{checks}};
  131. cmp_ok(
  132. $request->format_amount({
  133. amount => $check->{amount},
  134. format => '1000.00',
  135. precision => 2
  136. }), 'eq', '105900.00',
  137. 'Printed amount is correct'
  138. );
  139. }
  140. };
  141. opendir (D62, 't/data/62.d');
  142. for my $testfile (readdir(D62)){
  143. do "t/data/62.d/$testfile";
  144. };