Bugzilla – Attachment 57175 Details for
Bug 15896
Use Koha::Account::pay internally for makepayment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15896 - Unit Tests
Bug-15896---Unit-Tests.patch (text/plain), 2.61 KB, created by
Kyle M Hall (khall)
on 2016-11-04 10:41:23 UTC
(
hide
)
Description:
Bug 15896 - Unit Tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-11-04 10:41:23 UTC
Size:
2.61 KB
patch
obsolete
>From 454e8152120ed78ad6cacf9c729f16d9b76b0e75 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 4 Nov 2016 10:40:38 +0000 >Subject: [PATCH] Bug 15896 - Unit Tests > >--- > t/db_dependent/Accounts.t | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index afbe8e9..68efb76 100644 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -56,13 +56,13 @@ $schema->storage->txn_begin; > my $dbh = C4::Context->dbh; > > my $builder = t::lib::TestBuilder->new; >-my $library = $builder->build({ source => 'Branch' }); >+my $library = $builder->build( { source => 'Branch' } ); > > $dbh->do(q|DELETE FROM accountlines|); > $dbh->do(q|DELETE FROM issues|); > $dbh->do(q|DELETE FROM borrowers|); > >-my $branchcode = $library->{branchcode}; >+my $branchcode = $library->{branchcode}; > my $borrower_number; > > my $context = new Test::MockModule('C4::Context'); >@@ -138,7 +138,7 @@ $dbh->do(q|DELETE FROM accountlines|); > > subtest "Koha::Account::pay tests" => sub { > >- plan tests => 10; >+ plan tests => 12; > > # Create a borrower > my $categorycode = $builder->build({ source => 'Category' })->{ categorycode }; >@@ -225,6 +225,7 @@ subtest "Koha::Account::pay tests" => sub { > $amountleft += $line; > } > is($amountleft, 160, 'The account has $160 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); >@@ -244,11 +245,19 @@ subtest "Koha::Account::pay tests" => sub { > $amountleft += $line; > } > is($amountleft, -40, 'The account has -$40 as expected, (credit situation)' ); >+ > # 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); > $note = $sth->fetchrow_array; > is($note,'$200.00 payment note', '$200.00 payment note is registered'); >+ >+ my $line3 = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 42 })->store(); >+ my $payment_id = $account->pay( { accountlines_id => $line3->id, 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 "makepayment() tests" => sub { >-- >2.1.4
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 15896
:
48332
|
51920
|
52139
|
53314
|
53782
|
53783
|
53784
|
53785
|
53786
|
55924
|
55925
|
57175
|
57176
|
57177
|
57178
|
57182
|
57183
|
57184
|
57185
|
57186
|
57187
|
57188
|
57189
|
57190
|
57191
|
57192
|
57193