Bugzilla – Attachment 185467 Details for
Bug 39883
NEW_SUGGESTION email notices end up in the patrons notice tab (members/notices.pl) when they should not
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39883: ( follow-up ) Adjust tests to not rely on borrowernumber
Bug-39883--follow-up--Adjust-tests-to-not-rely-on-.patch (text/plain), 7.33 KB, created by
Lucas Gass (lukeg)
on 2025-08-15 15:15:23 UTC
(
hide
)
Description:
Bug 39883: ( follow-up ) Adjust tests to not rely on borrowernumber
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-08-15 15:15:23 UTC
Size:
7.33 KB
patch
obsolete
>From af46c0386511ce2cff4602c1f26f990fba04e4a1 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 15 Aug 2025 15:14:04 +0000 >Subject: [PATCH] Bug 39883: ( follow-up ) Adjust tests to not rely on > borrowernumber > >--- > t/db_dependent/Suggestions.t | 52 ++++++++++++++++++++---------------- > 1 file changed, 29 insertions(+), 23 deletions(-) > >diff --git a/t/db_dependent/Suggestions.t b/t/db_dependent/Suggestions.t >index d7d289f7f06..9ee869c59fd 100755 >--- a/t/db_dependent/Suggestions.t >+++ b/t/db_dependent/Suggestions.t >@@ -611,8 +611,9 @@ subtest 'EmailPurchaseSuggestions' => sub { > > # EmailPurchaseSuggestions set to disabled > t::lib::Mocks::mock_preference( "EmailPurchaseSuggestions", "0" ); >+ $dbh->do(q|DELETE FROM message_queue|); > Koha::Suggestion->new($my_suggestion)->store; >- my $newsuggestions_messages = C4::Letters::GetQueuedMessages( { borrowernumber => $borrowernumber } ); >+ my $newsuggestions_messages = C4::Letters::GetQueuedMessages(); > is( > @$newsuggestions_messages, 0, > 'New suggestion does not send an email when EmailPurchaseSuggestions disabled' >@@ -623,39 +624,42 @@ subtest 'EmailPurchaseSuggestions' => sub { > t::lib::Mocks::mock_preference( "ReplytoDefault", "" ); > t::lib::Mocks::mock_preference( "EmailAddressForSuggestions", "" ); > Koha::Libraries->find('CPL')->update( { branchemail => '', branchreplyto => '' } ); >+ $dbh->do(q|DELETE FROM message_queue|); > Koha::Suggestion->new($my_suggestion)->store; >+ $newsuggestions_messages = C4::Letters::GetQueuedMessages(); >+ my $message1 = C4::Letters::GetMessage( $newsuggestions_messages->[0]->{message_id} ); > > t::lib::Mocks::mock_preference( "ReplytoDefault", 'library@b.c' ); >+ $dbh->do(q|DELETE FROM message_queue|); > Koha::Suggestion->new($my_suggestion)->store; >+ $newsuggestions_messages = C4::Letters::GetQueuedMessages(); >+ my $message2 = C4::Letters::GetMessage( $newsuggestions_messages->[0]->{message_id} ); > > Koha::Libraries->find('CPL')->update( { branchemail => 'branchemail@hosting.com' } ); >+ $dbh->do(q|DELETE FROM message_queue|); > Koha::Suggestion->new($my_suggestion)->store; >+ $newsuggestions_messages = C4::Letters::GetQueuedMessages(); >+ my $message3 = C4::Letters::GetMessage( $newsuggestions_messages->[0]->{message_id} ); > > Koha::Libraries->find('CPL')->update( { branchreplyto => 'branchemail@b.c' } ); >+ $dbh->do(q|DELETE FROM message_queue|); > Koha::Suggestion->new($my_suggestion)->store; >+ $newsuggestions_messages = C4::Letters::GetQueuedMessages(); >+ my $message4 = C4::Letters::GetMessage( $newsuggestions_messages->[0]->{message_id} ); > >- $newsuggestions_messages = C4::Letters::GetQueuedMessages( { borrowernumber => $borrowernumber } ); > isnt( @$newsuggestions_messages, 0, 'New suggestions sends an email wne EmailPurchaseSuggestions enabled' ); >- my $message1 = >- C4::Letters::GetMessage( $newsuggestions_messages->[0]->{message_id} ); > is( > $message1->{to_address}, 'noreply@hosting.com', > 'BranchEmailAddress falls back to KohaAdminEmailAddress if branchreplyto, branchemail and ReplytoDefault are not set' > ); >- my $message2 = >- C4::Letters::GetMessage( $newsuggestions_messages->[1]->{message_id} ); > is( > $message2->{to_address}, 'library@b.c', > 'BranchEmailAddress falls back to ReplytoDefault if neither branchreplyto or branchemail are set' > ); >- my $message3 = >- C4::Letters::GetMessage( $newsuggestions_messages->[2]->{message_id} ); > is( > $message3->{to_address}, 'branchemail@hosting.com', > 'BranchEmailAddress uses branchemail if branch_replto is not set' > ); >- my $message4 = >- C4::Letters::GetMessage( $newsuggestions_messages->[3]->{message_id} ); > is( > $message4->{to_address}, 'branchemail@b.c', > 'BranchEmailAddress uses branchreplyto in preference to branchemail when set' >@@ -668,20 +672,21 @@ subtest 'EmailPurchaseSuggestions' => sub { > ); > > t::lib::Mocks::mock_preference( "ReplytoDefault", undef ); >+ $dbh->do(q|DELETE FROM message_queue|); > Koha::Suggestion->new($my_suggestion)->store; >+ $newsuggestions_messages = C4::Letters::GetQueuedMessages(); >+ my $message5 = C4::Letters::GetMessage( $newsuggestions_messages->[0]->{message_id} ); > > t::lib::Mocks::mock_preference( "ReplytoDefault", 'library@b.c' ); >+ $dbh->do(q|DELETE FROM message_queue|); > Koha::Suggestion->new($my_suggestion)->store; >+ $newsuggestions_messages = C4::Letters::GetQueuedMessages(); >+ my $message6 = C4::Letters::GetMessage( $newsuggestions_messages->[0]->{message_id} ); > >- $newsuggestions_messages = C4::Letters::GetQueuedMessages( { borrowernumber => $borrowernumber } ); >- my $message5 = >- C4::Letters::GetMessage( $newsuggestions_messages->[4]->{message_id} ); > is( > $message5->{to_address}, > 'noreply@hosting.com', 'KohaAdminEmailAddress uses KohaAdminEmailAddress when ReplytoDefault is not set' > ); >- my $message6 = >- C4::Letters::GetMessage( $newsuggestions_messages->[5]->{message_id} ); > is( > $message6->{to_address}, > 'library@b.c', 'KohaAdminEmailAddress uses ReplytoDefualt when ReplytoDefault is set' >@@ -694,41 +699,42 @@ subtest 'EmailPurchaseSuggestions' => sub { > ); > > t::lib::Mocks::mock_preference( "ReplytoDefault", undef ); >+ $dbh->do(q|DELETE FROM message_queue|); > Koha::Suggestion->new($my_suggestion)->store; >+ $newsuggestions_messages = C4::Letters::GetQueuedMessages(); >+ my $message7 = C4::Letters::GetMessage( $newsuggestions_messages->[0]->{message_id} ); > > t::lib::Mocks::mock_preference( "ReplytoDefault", 'library@b.c' ); >+ $dbh->do(q|DELETE FROM message_queue|); > Koha::Suggestion->new($my_suggestion)->store; >+ $newsuggestions_messages = C4::Letters::GetQueuedMessages(); >+ my $message8 = C4::Letters::GetMessage( $newsuggestions_messages->[0]->{message_id} ); > > t::lib::Mocks::mock_preference( > "EmailAddressForSuggestions", > 'suggestions@b.c' > ); >+ $dbh->do(q|DELETE FROM message_queue|); > Koha::Suggestion->new($my_suggestion)->store; >+ $newsuggestions_messages = C4::Letters::GetQueuedMessages(); >+ my $message9 = C4::Letters::GetMessage( $newsuggestions_messages->[0]->{message_id} ); > >- $newsuggestions_messages = C4::Letters::GetQueuedMessages( { borrowernumber => $borrowernumber } ); >- my $message7 = >- C4::Letters::GetMessage( $newsuggestions_messages->[6]->{message_id} ); > is( > $message7->{to_address}, > 'noreply@hosting.com', > 'EmailAddressForSuggestions uses KohaAdminEmailAddress when neither EmailAddressForSuggestions or ReplytoDefault are set' > ); > >- my $message8 = >- C4::Letters::GetMessage( $newsuggestions_messages->[7]->{message_id} ); > is( > $message8->{to_address}, > 'library@b.c', 'EmailAddressForSuggestions uses ReplytoDefault when EmailAddressForSuggestions is not set' > ); > >- my $message9 = >- C4::Letters::GetMessage( $newsuggestions_messages->[8]->{message_id} ); > is( > $message9->{to_address}, > 'suggestions@b.c', 'EmailAddressForSuggestions uses EmailAddressForSuggestions when set' > ); > }; >- > subtest 'ModSuggestion should work on suggestions without a suggester' => sub { > plan tests => 2; > >-- >2.39.5
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 39883
:
182315
|
182391
|
185133
|
185467
|
185471