From 150dc5ff64ba8f6daf3d6fc4b6790a871d75a9ee Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Sun, 21 Apr 2024 23:12:55 +0000 Subject: [PATCH] Bug 23781: Tests for Recalls messaging preferences - t/db_dependent/Koha/Recall.t - t/db_dependent/Koha/Recalls.t --- t/db_dependent/Koha/Recall.t | 8 ++++++++ t/db_dependent/Koha/Recalls.t | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Recall.t b/t/db_dependent/Koha/Recall.t index 1b4f8f70ebb..4d6eff783e8 100755 --- a/t/db_dependent/Koha/Recall.t +++ b/t/db_dependent/Koha/Recall.t @@ -126,6 +126,14 @@ $expected_expirationdate = dt_from_string->add({ days => 3 }); $expirationdate = $recall2->calc_expirationdate; is( t::lib::Dates::compare( $expirationdate, $expected_expirationdate ), 0, "Expiration date calculated based on circulation rules" ); +C4::Members::Messaging::SetMessagingPreference( + { + borrowernumber => $patron1->borrowernumber, + message_attribute_id => 12, # Recall_Waiting + message_transport_types => [qw( email sms )], + } +); + $recall2->set_waiting({ expirationdate => $expirationdate }); is( $recall2->waiting, 1, "Recall is waiting" ); diff --git a/t/db_dependent/Koha/Recalls.t b/t/db_dependent/Koha/Recalls.t index 546bbf21c45..ed0193428cc 100755 --- a/t/db_dependent/Koha/Recalls.t +++ b/t/db_dependent/Koha/Recalls.t @@ -68,6 +68,14 @@ Koha::CirculationRules->set_rules({ C4::Circulation::AddIssue( $patron3, $item1->barcode ); C4::Circulation::AddIssue( $patron3, $item2->barcode ); +C4::Members::Messaging::SetMessagingPreference( + { + borrowernumber => $patron3->borrowernumber, + message_attribute_id => 13, # Recall_Requested + message_transport_types => [qw( email sms )], + } +); + my ( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({ patron => undef, biblio => $biblio1, @@ -147,7 +155,7 @@ is( is( t::lib::Dates::compare( $due_date, $expected_due_date ), 0, "Due date correctly returned" ); my $messages_count = Koha::Notice::Messages->search({ borrowernumber => $patron3->borrowernumber, letter_code => 'RETURN_RECALLED_ITEM' })->count; -is( $messages_count, 3, "RETURN_RECALLED_ITEM notice successfully sent to checkout borrower" ); +is( $messages_count, 6, "RETURN_RECALLED_ITEM notice successfully sent to checkout borrower" ); my $message = Koha::Recalls->move_recall; is( $message, 'no recall_id provided', "Can't move a recall without specifying which recall" ); -- 2.30.2