Bugzilla – Attachment 89496 Details for
Bug 22610
SIP Payment Types should be moved out of accountype
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22610: (QA follow-up) Add unit tests for FeePayment
Bug-22610-QA-follow-up-Add-unit-tests-for-FeePayme.patch (text/plain), 2.67 KB, created by
Martin Renvoize
on 2019-05-09 10:37:44 UTC
(
hide
)
Description:
Bug 22610: (QA follow-up) Add unit tests for FeePayment
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2019-05-09 10:37:44 UTC
Size:
2.67 KB
patch
obsolete
>From 757b9f72e887696f703039e3c2c3e8fba02ae799 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 9 May 2019 11:35:58 +0100 >Subject: [PATCH] Bug 22610: (QA follow-up) Add unit tests for FeePayment > >--- > t/db_dependent/SIP/Transaction.t | 43 +++++++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index 646a5c153d..f4c876a837 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -4,7 +4,7 @@ > # Current state is very rudimentary. Please help to extend it! > > use Modern::Perl; >-use Test::More tests => 4; >+use Test::More tests => 5; > > use Koha::Database; > use t::lib::TestBuilder; >@@ -12,6 +12,7 @@ use t::lib::Mocks; > use C4::SIP::ILS::Patron; > use C4::SIP::ILS::Transaction::RenewAll; > use C4::SIP::ILS::Transaction::Checkout; >+use C4::SIP::ILS::Transaction::FeePayment; > > use C4::Reserves; > use Koha::IssuingRules; >@@ -90,4 +91,44 @@ subtest fill_holds_at_checkout => sub { > > > }; >+ >+subtest "FeePayment->pay tests" => sub { >+ >+ plan tests => 5; >+ >+ # Create a borrower and add some outstanding debts to their account >+ my $patron = $builder->build( { source => 'Borrower' } ); >+ my $account = >+ Koha::Account->new( { patron_id => $patron->{borrowernumber} } ); >+ my $debt1 = $account->add_debit( >+ { type => 'account', amount => 100, interface => 'commandline' } ); >+ my $debt2 = $account->add_debit( >+ { type => 'account', amount => 200, interface => 'commandline' } ); >+ >+ # Instantiate a new FeePayment transaction object >+ my $trans = C4::SIP::ILS::Transaction::FeePayment->new(); >+ is( >+ ref $trans, >+ "C4::SIP::ILS::Transaction::FeePayment", >+ "New fee transaction created" >+ ); >+ >+ # Test the 'pay' method >+ # FIXME: pay should not require a borrowernumber >+ # (we should reach out to the transaction which should contain a patron object) >+ my $pay_type = '00'; # 00 - Cash, 01 - VISA, 02 - Creditcard >+ my $ok = >+ $trans->pay( $patron->{borrowernumber}, 100, $pay_type, $debt1->id, 0, >+ 0 ); >+ ok( $ok, "FeePayment transaction succeeded" ); >+ $debt1->discard_changes; >+ is( $debt1->amountoutstanding + 0, 0, >+ "Debt1 was reduced to 0 as expected" ); >+ my $offsets = Koha::Account::Offsets->search( >+ { debit_id => $debt1->id, credit_id => { '!=' => undef } } ); >+ is( $offsets->count, 1, "FeePayment produced an offset line correctly" ); >+ my $credit = $offsets->next->credit; >+ is( $credit->payment_type, 'SIP00', "Payment type was set correctly" ); >+}; >+ > $schema->storage->txn_rollback; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22610
:
88619
|
88620
|
89460
|
89461
|
89470
|
89471
|
89492
|
89493
|
89494
|
89495
|
89496
|
89498
|
89499
|
89500
|
89501
|
89502
|
89503
|
91638
|
91639
|
91640
|
91641
|
91642
|
91643