Bugzilla – Attachment 74506 Details for
Bug 19191
Add ability to email receipts for account payments and write-offs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19191: Add correct unit tests
Bug-19191-Add-correct-unit-tests.patch (text/plain), 3.87 KB, created by
Katrin Fischer
on 2018-04-18 21:47:46 UTC
(
hide
)
Description:
Bug 19191: Add correct unit tests
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-04-18 21:47:46 UTC
Size:
3.87 KB
patch
obsolete
>From 7fd12b6bb15a638b2e30ebfb670f45833d2a0924 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 12 Apr 2018 14:12:29 +0000 >Subject: [PATCH] Bug 19191: Add correct unit tests > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Accounts.t | 56 +++++++++++++++++++++++++++++------------------ > 1 file changed, 35 insertions(+), 21 deletions(-) > >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index 72589cb..1f8b473 100644 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -28,6 +28,8 @@ use t::lib::Mocks; > use Koha::Account; > use Koha::Account::Lines; > use Koha::Account::Offsets; >+use Koha::Notice::Messages; >+use Koha::Notice::Templates; > use Koha::DateUtils qw( dt_from_string ); > > BEGIN { >@@ -844,40 +846,52 @@ subtest "Koha::Account::non_issues_charges tests" => sub { > is( Koha::Account::Lines->count({ borrowernumber => $patron->id }), 2 + 2, "The 2 + 2 account lines still exists, the last 2 have been deleted ok" ); > }; > >-subtest "Koha::Account::Offset tests" => sub { >+subtest "Payment notice tests" => sub { > >- plan tests => 2; >+ plan tests => 6; > > Koha::Account::Lines->delete(); > Koha::Patrons->delete(); >- >+ Koha::Notice::Messages->delete(); > # Create a borrower > my $categorycode = $builder->build({ source => 'Category' })->{ categorycode }; > my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; > >- my $borrower = Koha::Patron->new( { >- cardnumber => 'chelseahall', >- surname => 'Hall', >- firstname => 'Chelsea', >- } ); >- $borrower->categorycode( $categorycode ); >- $borrower->branchcode( $branchcode ); >- $borrower->store; >+ my $borrower = Koha::Patron->new( >+ { >+ cardnumber => 'chelseahall', >+ surname => 'Hall', >+ firstname => 'Chelsea', >+ email => 'chelsea@example.com', >+ categorycode => $categorycode, >+ branchcode => $branchcode, >+ } >+ )->store(); > > my $account = Koha::Account->new({ patron_id => $borrower->id }); > > my $line = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 27 })->store(); > >- my $id = $account->pay( >- { >- amount => 13, >- } >- ); >- >- my $offset = Koha::Account::Offsets->find( { credit_id => $id } ); >- >- is( $offset->credit->id, $id, 'Got correct credit for account offset' ); >- is( $offset->debit->id, $line->id, 'Got correct debit for account offset' ); >+ my $letter = Koha::Notice::Templates->find( { code => 'ACCOUNT_PAYMENT' } ); >+ $letter->content('[%- USE Price -%]A payment of [% credit.amount * -1 | $Price %] has been applied to your account.'); >+ $letter->store(); >+ >+ my $id = $account->pay( { amount => 13 } ); >+ my $notice = Koha::Notice::Messages->search()->next(); >+ is( $notice->subject, 'Account Payment', 'Notice subject is correct for payment' ); >+ is( $notice->letter_code, 'ACCOUNT_PAYMENT', 'Notice letter code is correct for payment' ); >+ is( $notice->content, 'A payment of 13.00 has been applied to your account.', 'Notice content is correct for payment' ); >+ $notice->delete(); >+ >+ $letter = Koha::Notice::Templates->find( { code => 'ACCOUNT_WRITEOFF' } ); >+ $letter->content('[%- USE Price -%]A writeoff of [% credit.amount * -1 | $Price %] has been applied to your account.'); >+ $letter->store(); >+ >+ $id = $account->pay( { amount => 14, type => 'writeoff' } ); >+ $notice = Koha::Notice::Messages->search()->next(); >+ is( $notice->subject, 'Account Writeoff', 'Notice subject is correct for payment' ); >+ is( $notice->letter_code, 'ACCOUNT_WRITEOFF', 'Notice letter code is correct for writeoff' ); >+ is( $notice->content, 'A writeoff of 14.00 has been applied to your account.', 'Notice content is correct for writeoff' ); > }; > > 1; >-- >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 19191
:
66554
|
68605
|
68812
|
70465
|
70466
|
70471
|
72366
|
72367
|
72370
|
73924
|
74092
|
74093
|
74094
|
74095
|
74104
|
74105
|
74423
|
74424
|
74504
|
74505
|
74506
|
74507
|
74508
|
74625
|
74626
|
74627
|
74628
|
74629
|
74630
|
74631
|
74686
|
75066
|
75067
|
75068
|
75069
|
75070
|
75071
|
75072
|
75093
|
75134