Bugzilla – Attachment 58726 Details for
Bug 15897
Use Koha::Account::pay internally for recordpayment_selectaccts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15897 [QA Followup] - Update unit tests
Bug-15897-QA-Followup---Update-unit-tests.patch (text/plain), 3.45 KB, created by
Jonathan Druart
on 2017-01-10 09:22:02 UTC
(
hide
)
Description:
Bug 15897 [QA Followup] - Update unit tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-01-10 09:22:02 UTC
Size:
3.45 KB
patch
obsolete
>From fe770f91372360935d2d56314d685bc37b09a409 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 9 Jan 2017 17:19:54 +0000 >Subject: [PATCH] Bug 15897 [QA Followup] - Update unit tests > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > t/db_dependent/Accounts.t | 49 +++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 47 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index a2a96b2..6d58726 100644 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -18,7 +18,7 @@ > > use Modern::Perl; > >-use Test::More tests => 20; >+use Test::More tests => 21; > use Test::MockModule; > use Test::Warn; > >@@ -253,13 +253,58 @@ subtest "Koha::Account::pay tests" => sub { > is($note,'$200.00 payment note', '$200.00 payment note is registered'); > > my $line3 = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 42, accounttype => 'TEST' })->store(); >- my $payment_id = $account->pay( { accountlines_id => $line3->id, amount => 42 } ); >+ my $payment_id = $account->pay( { lines => [$line3], amount => 42 } ); > my $payment = Koha::Account::Lines->find( $payment_id ); > is( $payment->amount(), '-42.000000', "Payment paid the specified fine" ); > $line3 = Koha::Account::Lines->find( $line3->id ); > is( $line3->amountoutstanding, '0.000000', "Specified fine is paid" ); > }; > >+subtest "Koha::Account::pay particular line tests" => sub { >+ >+ plan tests => 5; >+ >+ # Create a borrower >+ my $categorycode = $builder->build({ source => 'Category' })->{ categorycode }; >+ my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; >+ >+ my $borrower = Koha::Patron->new( { >+ cardnumber => 'kylemhall', >+ surname => 'Hall', >+ firstname => 'Kyle', >+ } ); >+ $borrower->categorycode( $categorycode ); >+ $borrower->branchcode( $branchcode ); >+ $borrower->store; >+ >+ my $account = Koha::Account->new({ patron_id => $borrower->id }); >+ >+ my $line1 = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 1 })->store(); >+ my $line2 = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 2 })->store(); >+ my $line3 = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 3 })->store(); >+ my $line4 = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 4 })->store(); >+ >+ is( $account->balance(), "10.000000", "Account balance is 10" ); >+ >+ $account->pay( >+ { >+ lines => [$line2, $line3, $line4], >+ amount => 4, >+ } >+ ); >+ >+ $_->_result->discard_changes foreach ( $line1, $line2, $line3, $line4 ); >+ >+ # Line1 is not paid at all, as it was not passed in the lines param >+ is( $line1->amountoutstanding, "1.000000", "Line 1 was not paid" ); >+ # Line2 was paid in full, as it was the first in the lines list >+ is( $line2->amountoutstanding, "0.000000", "Line 2 was paid in full" ); >+ # Line3 was paid partially, as the remaining balance did not cover it entirely >+ is( $line3->amountoutstanding, "1.000000", "Line 3 was paid to 1.00" ); >+ # Line4 was not paid at all, as the payment was all used up by that point >+ is( $line4->amountoutstanding, "4.000000", "Line 4 was not paid" ); >+}; >+ > subtest "makepayment() tests" => sub { > > plan tests => 6; >-- >2.9.3
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 15897
:
48333
|
52140
|
58084
|
58092
|
58094
|
58698
|
58699
|
58700
|
58701
|
58702
|
58724
|
58725
| 58726 |
58727