Bugzilla – Attachment 157997 Details for
Bug 17617
Add the ability of sending a confirmation e-mail to patron when hold is placed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17617: Unit tests
Bug-17617-Unit-tests.patch (text/plain), 3.80 KB, created by
ByWater Sandboxes
on 2023-10-27 18:13:20 UTC
(
hide
)
Description:
Bug 17617: Unit tests
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2023-10-27 18:13:20 UTC
Size:
3.80 KB
patch
obsolete
>From db51e1f43d16b214d5a8ab26055ee10249d624ee Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 26 Oct 2023 21:06:35 +0000 >Subject: [PATCH] Bug 17617: Unit tests > >Signed-off-by: Kelly <kelly@bywatersolutions.com> >--- > t/db_dependent/Holds.t | 82 ++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 80 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 39224e9905..4c78b4c480 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -7,7 +7,7 @@ use t::lib::TestBuilder; > > use C4::Context; > >-use Test::More tests => 73; >+use Test::More tests => 74; > use Test::Exception; > > use MARC::Record; >@@ -15,7 +15,7 @@ use MARC::Record; > use C4::Biblio; > use C4::Calendar; > use C4::Items; >-use C4::Reserves qw( AddReserve CalculatePriority ModReserve ToggleSuspend AutoUnsuspendReserves SuspendAll ModReserveMinusPriority AlterPriority CanItemBeReserved CheckReserves ); >+use C4::Reserves qw( AddReserve CalculatePriority ModReserve ToggleSuspend AutoUnsuspendReserves SuspendAll ModReserveMinusPriority AlterPriority CanItemBeReserved CheckReserves MoveReserve ); > use C4::Circulation qw( CanBookBeRenewed ); > > use Koha::Biblios; >@@ -1809,3 +1809,81 @@ subtest 'Koha::Holds->get_items_that_can_fill returns items with datecancelled o > > $schema->storage->txn_rollback; > }; >+ >+subtest 'EmailPatronWhenHoldIsPlaced tests' => sub { >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ my $item = $builder->build_sample_item; >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $borrowernumber = $patron->id; >+ Koha::CirculationRules->set_rules( >+ { >+ categorycode => undef, >+ branchcode => undef, >+ itemtype => undef, >+ rules => { >+ reservesallowed => 25, >+ holds_per_record => 99, >+ } >+ } >+ ); >+ >+ t::lib::Mocks::mock_preference( 'EmailPatronWhenHoldIsPlaced', 0 ); >+ my $original_notices_count = Koha::Notice::Messages->search( >+ { >+ letter_code => 'HOLDPLACED_PATRON', >+ to_address => $patron->notice_email_address, >+ } >+ )->count; >+ >+ my $hold_id = AddReserve( >+ { >+ branchcode => $item->homebranch, >+ borrowernumber => $borrowernumber, >+ biblionumber => $item->biblionumber, >+ itemnumber => $item->itemnumber, >+ } >+ ); >+ my $post_notices_count = Koha::Notice::Messages->search( >+ { >+ letter_code => 'HOLDPLACED_PATRON', >+ to_address => $patron->notice_email_address, >+ } >+ )->count; >+ is( >+ $post_notices_count, $original_notices_count, >+ "EmailPatronWhenHoldIsPlaced is disabled so no email is queued" >+ ); >+ MoveReserve( $item->itemnumber, $borrowernumber, 1 ); >+ >+ $original_notices_count = Koha::Notice::Messages->search( >+ { >+ letter_code => 'HOLDPLACED_PATRON', >+ to_address => $patron->notice_email_address, >+ } >+ )->count; >+ t::lib::Mocks::mock_preference( 'EmailPatronWhenHoldIsPlaced', 1 ); >+ AddReserve( >+ { >+ branchcode => $item->homebranch, >+ borrowernumber => $borrowernumber, >+ biblionumber => $item->biblionumber, >+ itemnumber => $item->itemnumber, >+ } >+ ); >+ $post_notices_count = Koha::Notice::Messages->search( >+ { >+ letter_code => 'HOLDPLACED_PATRON', >+ to_address => $patron->notice_email_address, >+ } >+ )->count; >+ is( >+ $post_notices_count, >+ $original_notices_count + 1, >+ "EmailPatronWhenHoldIsPlaced is enabled so HOLDPLACED_PATRON email is queued" >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.30.2
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 17617
:
157961
|
157962
|
157963
|
157964
|
157995
|
157996
|
157997
|
157998
|
158310
|
158311
|
158312
|
158313