Bugzilla – Attachment 98821 Details for
Bug 13961
Option to include patron's total amount of fines in notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13961: Add unit test
0003-Bug-13961-Add-unit-test.patch (text/plain), 3.15 KB, created by
Emmi Takkinen
on 2020-02-13 12:45:58 UTC
(
hide
)
Description:
Bug 13961: Add unit test
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2020-02-13 12:45:58 UTC
Size:
3.15 KB
patch
obsolete
>From d5049580070af1d2f8a4fdc8bb67f3f0944724c6 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@outlook.com> >Date: Mon, 10 Feb 2020 13:55:28 +0200 >Subject: [PATCH 3/3] Bug 13961: Add unit test > >Sponsored-by: Koha-Suomi Oy >--- > t/db_dependent/Letters.t | 28 +++++++++++++++++++++++++++- > 1 file changed, 27 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index bdeed6ead6..cdee2444d4 100644 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -18,11 +18,12 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 73; >+use Test::More tests => 74; > use Test::MockModule; > use Test::Warn; > > use MARC::Record; >+use Locale::Currency::Format; > > my %mail; > my $module = new Test::MockModule('Mail::Sendmail'); >@@ -50,6 +51,8 @@ use Koha::Libraries; > use Koha::Notice::Templates; > use Koha::Patrons; > use Koha::Subscriptions; >+use Koha::Account; >+use Koha::Account::Lines; > my $schema = Koha::Database->schema; > $schema->storage->txn_begin(); > >@@ -355,6 +358,29 @@ is( $prepared_letter->{content}, q|And also this one:| . output_pref({ dt => $ye > $dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('claimacquisition','TESTACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>|<<aqcontacts.name>>|<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered)</order>');}); > $dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('orderacquisition','TESTACQORDER','Acquisition Order','Order','<<aqbooksellers.name>>|<<aqcontacts.name>>|<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered)</order>');}); > >+# Test borrowers.account_balance >+my $account = Koha::Account->new({ patron_id => $borrowernumber }); >+$account->add_debit({ amount => 10, interface => 'test', type => 'OVERDUE'})->store; >+$account->add_debit({ amount => 15, interface => 'test', type => 'OVERDUE'})->store; >+ >+my $lines = Koha::Account::Lines->search({ borrowernumber => $borrowernumber }); >+my $totalfine = $lines->total_outstanding; >+my $active_currency = Koha::Acquisition::Currencies->get_active; >+my $currency_format = $active_currency->currency if defined($active_currency); >+my $totalfine_formatted = currency_format($currency_format, "$totalfine", FMT_SYMBOL); >+$totalfine_formatted = sprintf("%.2f", $totalfine) unless $totalfine_formatted; >+ >+$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('test_fines','TEST_FINES','Test total of fines','','Total of fines is: <<borrowers.account_balance>>.');}); >+$prepared_letter = GetPreparedLetter(( >+ module => 'test_fines', >+ branchcode => '', >+ letter_code => 'test_fines', >+ tables => $tables, >+ substitute => $substitute, >+ repeat => $repeat, >+)); >+is( $prepared_letter->{content}, q|Total of fines is: | . $totalfine_formatted . q|.|, 'Account balance is printed correctly' ); >+ > # Test that _parseletter doesn't modify its parameters bug 15429 > { > my $values = { dateexpiry => '2015-12-13', }; >-- >2.17.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 13961
:
41872
|
42077
|
42089
|
50517
|
98819
|
98820
|
98821
|
106192
|
106193
|
106194
|
106623
|
106624
|
116631
|
116632
|
116633
|
116634
|
116635
|
121854