Bugzilla – Attachment 55878 Details for
Bug 15899
Remove the use of recordpayment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15899 - Fix up unit tests
Bug-15899---Fix-up-unit-tests.patch (text/plain), 4.36 KB, created by
Jonathan Druart
on 2016-09-28 11:10:30 UTC
(
hide
)
Description:
Bug 15899 - Fix up unit tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-09-28 11:10:30 UTC
Size:
4.36 KB
patch
obsolete
>From 717aa67d6a75471886147b4e57a27d4121a20c3f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 24 Feb 2016 15:05:21 +0000 >Subject: [PATCH] Bug 15899 - Fix up unit tests > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Accounts.t | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) > >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index f78882a..afbe8e9 100644 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -35,7 +35,7 @@ BEGIN { > } > > can_ok( 'C4::Accounts', >- qw( recordpayment >+ qw( > makepayment > getnextacctno > chargelostitem >@@ -136,7 +136,7 @@ for my $data (@test_data) { > > $dbh->do(q|DELETE FROM accountlines|); > >-subtest "recordpayment() tests" => sub { >+subtest "Koha::Account::pay tests" => sub { > > plan tests => 10; > >@@ -153,6 +153,8 @@ subtest "recordpayment() tests" => sub { > $borrower->branchcode( $branchcode ); > $borrower->store; > >+ my $account = Koha::Account->new({ patron_id => $borrower->id }); >+ > my $line1 = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 100 })->store(); > my $line2 = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 200 })->store(); > >@@ -161,7 +163,6 @@ subtest "recordpayment() tests" => sub { > my $count = $sth->fetchrow_array; > is($count, 2, 'There is 2 lines as expected'); > >- # Testing recordpayment ------------------------- > # There is $100 in the account > $sth = $dbh->prepare("SELECT amountoutstanding FROM accountlines WHERE borrowernumber=?"); > my $amountoutstanding = $dbh->selectcol_arrayref($sth, {}, $borrower->borrowernumber); >@@ -174,9 +175,9 @@ subtest "recordpayment() tests" => sub { > # We make a $20 payment > my $borrowernumber = $borrower->borrowernumber; > my $data = '20.00'; >- my $sys_paytype; > my $payment_note = '$20.00 payment note'; >- recordpayment($borrowernumber, $data, $sys_paytype, $payment_note); >+ $account->pay( { amount => $data, note => $payment_note } ); >+ > # There is now $280 in the account > $sth = $dbh->prepare("SELECT amountoutstanding FROM accountlines WHERE borrowernumber=?"); > $amountoutstanding = $dbh->selectcol_arrayref($sth, {}, $borrower->borrowernumber); >@@ -185,6 +186,7 @@ subtest "recordpayment() tests" => sub { > $amountleft += $line; > } > is($amountleft, 280, 'The account has $280 as expected' ); >+ > # Is the payment note well registered > $sth = $dbh->prepare("SELECT note FROM accountlines WHERE borrowernumber=? ORDER BY accountlines_id DESC LIMIT 1"); > $sth->execute($borrower->borrowernumber); >@@ -194,7 +196,8 @@ subtest "recordpayment() tests" => sub { > # We make a -$30 payment (a NEGATIVE payment) > $data = '-30.00'; > $payment_note = '-$30.00 payment note'; >- recordpayment($borrowernumber, $data, $sys_paytype, $payment_note); >+ $account->pay( { amount => $data, note => $payment_note } ); >+ > # There is now $310 in the account > $sth = $dbh->prepare("SELECT amountoutstanding FROM accountlines WHERE borrowernumber=?"); > $amountoutstanding = $dbh->selectcol_arrayref($sth, {}, $borrower->borrowernumber); >@@ -212,7 +215,8 @@ subtest "recordpayment() tests" => sub { > #We make a $150 payment ( > 1stLine ) > $data = '150.00'; > $payment_note = '$150.00 payment note'; >- recordpayment($borrowernumber, $data, $sys_paytype, $payment_note); >+ $account->pay( { amount => $data, note => $payment_note } ); >+ > # There is now $160 in the account > $sth = $dbh->prepare("SELECT amountoutstanding FROM accountlines WHERE borrowernumber=?"); > $amountoutstanding = $dbh->selectcol_arrayref($sth, {}, $borrower->borrowernumber); >@@ -230,7 +234,8 @@ subtest "recordpayment() tests" => sub { > #We make a $200 payment ( > amountleft ) > $data = '200.00'; > $payment_note = '$200.00 payment note'; >- recordpayment($borrowernumber, $data, $sys_paytype, $payment_note); >+ $account->pay( { amount => $data, note => $payment_note } ); >+ > # There is now -$40 in the account > $sth = $dbh->prepare("SELECT amountoutstanding FROM accountlines WHERE borrowernumber=?"); > $amountoutstanding = $dbh->selectcol_arrayref($sth, {}, $borrower->borrowernumber); >-- >2.8.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 15899
:
48343
|
48344
|
48345
|
52137
|
52146
|
52147
|
54749
|
54750
| 55878 |
55879