Bugzilla – Attachment 148839 Details for
Bug 18398
CHECKIN/CHECKOUT/RENEWAL don't use AutoEmailPrimaryAddress but first valid e-mail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18398: (follow-up) Update POD & Unit tests
Bug-18398-follow-up-Update-POD--Unit-tests.patch (text/plain), 3.58 KB, created by
Nick Clemens
on 2023-03-28 15:02:21 UTC
(
hide
)
Description:
Bug 18398: (follow-up) Update POD & Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2023-03-28 15:02:21 UTC
Size:
3.58 KB
patch
obsolete
>From 6c214d697500a7e923c34c96d70aa72a3fde839b Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 28 Mar 2023 12:35:05 +0100 >Subject: [PATCH] Bug 18398: (follow-up) Update POD & Unit tests > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/Message.pm | 8 ++++---- > t/db_dependent/Message.t | 15 ++++++++++++--- > 2 files changed, 16 insertions(+), 7 deletions(-) > >diff --git a/C4/Message.pm b/C4/Message.pm >index 8bf1a05b0a..68205083d5 100644 >--- a/C4/Message.pm >+++ b/C4/Message.pm >@@ -37,8 +37,8 @@ How to add a new message to the queue: > > use C4::Message; > use C4::Items; >- my $borrower = { borrowernumber => 1 }; >- my $item = Koha::Items->find($itemnumber)->unblessed; >+ my $patron = Koha::Patron->find({ borrowernumber => 1 }); >+ my $item = Koha::Items->find($itemnumber)->unblessed; > my $letter = C4::Letters::GetPreparedLetter ( > module => 'circulation', > letter_code => 'CHECKOUT', >@@ -48,7 +48,7 @@ How to add a new message to the queue: > 'biblioitems', $item->{biblionumber}, > }, > ); >- C4::Message->enqueue($letter, $borrower->{borrowernumber}, 'email'); >+ C4::Message->enqueue($letter, $patron, 'email'); > > How to update a borrower's last checkout message: > >@@ -148,7 +148,7 @@ sub find_last_message { > } > > >-=head3 C4::Message->enqueue($letter, $borrower, $transport) >+=head3 C4::Message->enqueue($letter, $patron, $transport) > > This is a front-end for C<C4::Letters::EnqueueLetter()> that adds metadata to > the message. >diff --git a/t/db_dependent/Message.t b/t/db_dependent/Message.t >index ab65e0ba1b..b223c56505 100755 >--- a/t/db_dependent/Message.t >+++ b/t/db_dependent/Message.t >@@ -16,11 +16,12 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 3; >+use Test::More tests => 5; > > use utf8; > > use t::lib::TestBuilder; >+use t::lib::Mocks; > > use C4::Letters qw( GetPreparedLetter ); > use Koha::Database; >@@ -37,7 +38,7 @@ $dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('test > ")}); > my $biblio_1 = $builder->build_sample_biblio({ title => "heÃllo" }); > my $biblio_2 = $builder->build_sample_biblio({ title => "hellâ¤ï¸" }); >-my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { email => 'test@example.org'} }); >+my $patron = $builder->build_object({ class => 'Koha::Patrons' }); > my $letter = C4::Letters::GetPreparedLetter( > ( > module => 'test', >@@ -48,9 +49,12 @@ my $letter = C4::Letters::GetPreparedLetter( > ) > ); > >-C4::Message->enqueue($letter, $patron->unblessed, 'email'); >+ >+t::lib::Mocks::mock_preference( 'AutoEmailPrimaryAddress', 'OFF' ); >+C4::Message->enqueue($letter, $patron, 'email'); > my $message = C4::Message->find_last_message($patron->unblessed, 'TEST_MESSAGE', 'email'); > like( $message->{metadata}, qr{heÃllo} ); >+is ($message->{to_address}, $patron->email, "To address set correctly for AutoEmailPrimaryAddress 'off'"); > > $letter = C4::Letters::GetPreparedLetter( > ( >@@ -64,3 +68,8 @@ $letter = C4::Letters::GetPreparedLetter( > $message->append($letter); > like( $message->{metadata}, qr{heÃllo} ); > like( $message->{metadata}, qr{hellâ¤ï¸} ); >+ >+t::lib::Mocks::mock_preference( 'AutoEmailPrimaryAddress', 'emailpro' ); >+C4::Message->enqueue($letter, $patron, 'email'); >+$message = C4::Message->find_last_message($patron->unblessed, 'TEST_MESSAGE', 'email'); >+is ($patron->notice_email_address, $patron->emailpro, "To address set correctly for AutoEmailPrimaryAddress 'emailpro'"); >-- >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 18398
:
148053
|
148130
|
148816
|
148817
|
148838
| 148839