Bugzilla – Attachment 125879 Details for
Bug 29062
Patron check-in slip repeats data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29062: Unit tests
Bug-29062-Unit-tests.patch (text/plain), 4.61 KB, created by
Nick Clemens (kidclamp)
on 2021-10-07 13:13:52 UTC
(
hide
)
Description:
Bug 29062: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-10-07 13:13:52 UTC
Size:
4.61 KB
patch
obsolete
>From c805facf575f19e57ba09fe40b132384ff9f3f8d Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 7 Oct 2021 13:13:20 +0000 >Subject: [PATCH] Bug 29062: Unit tests > >--- > t/db_dependent/Circulation.t | 61 ++++++++++++++++++++++++++++++++++-- > 1 file changed, 59 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index e054c74ab5..2862ea9cf8 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 55; >+use Test::More tests => 56; > use Test::Exception; > use Test::MockModule; > use Test::Deep qw( cmp_deeply ); >@@ -33,12 +33,13 @@ use t::lib::TestBuilder; > > use C4::Accounts; > use C4::Calendar qw( new insert_single_holiday insert_week_day_holiday delete_holiday ); >-use C4::Circulation qw( AddIssue AddReturn CanBookBeRenewed GetIssuingCharges AddRenewal GetSoonestRenewDate GetLatestAutoRenewDate LostItem GetUpcomingDueIssues CanBookBeIssued AddIssuingCharge ProcessOfflinePayment transferbook updateWrongTransfer ); >+use C4::Circulation qw( AddIssue AddReturn CanBookBeRenewed GetIssuingCharges AddRenewal GetSoonestRenewDate GetLatestAutoRenewDate LostItem GetUpcomingDueIssues CanBookBeIssued AddIssuingCharge MarkIssueReturned ProcessOfflinePayment transferbook updateWrongTransfer ); > use C4::Biblio; > use C4::Items qw( ModItemTransfer ); > use C4::Log; > use C4::Reserves qw( AddReserve ModReserve ModReserveCancelAll ModReserveAffect CheckReserves GetOtherReserves ); > use C4::Overdues qw( CalcFine UpdateFine get_chargeable_units ); >+use C4::Members::Messaging qw( SetMessagingPreference ); > use Koha::DateUtils; > use Koha::Database; > use Koha::Items; >@@ -51,6 +52,7 @@ use Koha::Subscriptions; > use Koha::Account::Lines; > use Koha::Account::Offsets; > use Koha::ActionLogs; >+use Koha::Notice::Messages; > > sub set_userenv { > my ( $library ) = @_; >@@ -4916,6 +4918,61 @@ subtest "updateWrongTransfer tests" => sub { > is( $original_transfer->cancellation_reason, 'WrongTransfer', "Original transfer cancellation reason is 'WrongTransfer'"); > }; > >+subtest "SendCirculationAlert" => sub { >+ plan tests => 2; >+ >+ # Setup branch, borrowr, and notice >+ my $library = $builder->build_object({ class => 'Koha::Libraries' }); >+ set_userenv( $library->unblessed); >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ C4::Members::Messaging::SetMessagingPreference({ >+ borrowernumber => $patron->id, >+ message_transport_types => ['email'], >+ message_attribute_id => 5 >+ }); >+ my $item = $builder->build_sample_item(); >+ my $checkin_notice = $builder->build_object({ >+ class => 'Koha::Notice::Templates', >+ value =>{ >+ module => 'circulation', >+ code => 'CHECKIN', >+ branchcode => $library->branchcode, >+ name => 'Test Checkin', >+ is_html => 0, >+ content => "Checkins:\n----\n[% biblio.title %]-[% old_checkout.issue_id %]\n----Thank you.", >+ message_transport_type => 'email', >+ lang => 'default' >+ } >+ })->store; >+ >+ # Checkout an item, mark it returned, generate a notice >+ my $issue_1 = AddIssue( $patron->unblessed, $item->barcode); >+ MarkIssueReturned( $patron->borrowernumber, $item->itemnumber, undef, 0, { skip_record_index => 1} ); >+ C4::Circulation::SendCirculationAlert({ >+ type => 'CHECKIN', >+ item => $item->unblessed, >+ borrower => $patron->unblessed, >+ branch => $library->branchcode, >+ issue => $issue_1 >+ }); >+ my $notice = Koha::Notice::Messages->find({ borrowernumber => $patron->id, letter_code => 'CHECKIN' }); >+ is($notice->content,"Checkins:\n".$item->biblio->title."-".$issue_1->id."\nThank you.", 'Letter generated with expected output on first checkin' ); >+ >+ # Checkout an item, mark it returned, generate a notice >+ my $issue_2 = AddIssue( $patron->unblessed, $item->barcode); >+ MarkIssueReturned( $patron->borrowernumber, $item->itemnumber, undef, 0, { skip_record_index => 1} ); >+ C4::Circulation::SendCirculationAlert({ >+ type => 'CHECKIN', >+ item => $item->unblessed, >+ borrower => $patron->unblessed, >+ branch => $library->branchcode, >+ issue => $issue_2 >+ }); >+ $notice->discard_changes(); >+ is($notice->content,"Checkins:\n".$item->biblio->title."-".$issue_1->id."\n".$item->biblio->title."-".$issue_2->id."\nThank you.", 'Letter appended with expected output on second checkin' ); >+ >+}; >+ > $schema->storage->txn_rollback; > C4::Context->clear_syspref_cache(); > $branches = Koha::Libraries->search(); >-- >2.20.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 29062
:
125129
|
125154
|
125712
|
125749
|
125806
|
125807
|
125809
| 125879