Bugzilla – Attachment 137202 Details for
Bug 30838
to_address is misleading for SMS transports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30838: (QA follow-up) Add unit tests
Bug-30838-QA-follow-up-Add-unit-tests.patch (text/plain), 3.92 KB, created by
Martin Renvoize (ashimema)
on 2022-07-06 10:56:01 UTC
(
hide
)
Description:
Bug 30838: (QA follow-up) Add unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-07-06 10:56:01 UTC
Size:
3.92 KB
patch
obsolete
>From 4675f0cd6e44d5d82162180eea5e7860a04eb8f0 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 6 Jul 2022 11:54:35 +0100 >Subject: [PATCH] Bug 30838: (QA follow-up) Add unit tests > >Two tests added, one in t/db_dependent/Circulation.t to catch the >initial setting of to_address at enqueue time and a second in >t/db_dependent/Letters.t to catch the correcting at send time. >--- > t/db_dependent/Circulation.t | 7 ++++--- > t/db_dependent/Letters.t | 17 +++++++++++++++-- > 2 files changed, 19 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index a62b6195a2..37d97b1409 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -5385,7 +5385,7 @@ subtest "updateWrongTransfer tests" => sub { > }; > > subtest "SendCirculationAlert" => sub { >- plan tests => 2; >+ plan tests => 3; > > # When you would unsuspectingly call this unit test (with perl, not prove), you will be bitten by LOCK. > # LOCK will commit changes and ruin your data >@@ -5398,7 +5398,7 @@ subtest "SendCirculationAlert" => sub { > my $patron = $builder->build_object({ class => 'Koha::Patrons' }); > C4::Members::Messaging::SetMessagingPreference({ > borrowernumber => $patron->id, >- message_transport_types => ['email'], >+ message_transport_types => ['sms'], > message_attribute_id => 5 > }); > my $item = $builder->build_sample_item(); >@@ -5411,7 +5411,7 @@ subtest "SendCirculationAlert" => sub { > name => 'Test Checkin', > is_html => 0, > content => "Checkins:\n----\n[% biblio.title %]-[% old_checkout.issue_id %]\n----Thank you.", >- message_transport_type => 'email', >+ message_transport_type => 'sms', > lang => 'default' > } > })->store; >@@ -5428,6 +5428,7 @@ subtest "SendCirculationAlert" => sub { > }); > 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' ); >+ is($notice->to_address, $patron->smsalertnumber, "Letter has the correct to_address set to smsalertnumber for SMS type notices"); > > # Checkout an item, mark it returned, generate a notice > my $issue_2 = AddIssue( $patron->unblessed, $item->barcode); >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index 27d640415a..426df4aea2 100755 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -779,9 +779,9 @@ subtest 'TranslateNotices' => sub { > > }; > >-subtest 'SendQueuedMessages' => sub { >+subtest 'Test SMS handling in SendQueuedMessages' => sub { > >- plan tests => 12; >+ plan tests => 13; > > t::lib::Mocks::mock_preference( 'SMSSendDriver', 'Email' ); > t::lib::Mocks::mock_preference('EmailSMSSendDriverFromAddress', ''); >@@ -855,6 +855,19 @@ subtest 'SendQueuedMessages' => sub { > })->next()->to_address(); > is( $sms_message_address, '5555555555@kidclamp.rocks', 'SendQueuedMessages populates the to address correctly for SMS by email when to_address is set incorrectly' ); > >+ # Test using SMS::Send::Test driver that's bundled with SMS::Send >+ t::lib::Mocks::mock_preference('SMSSendDriver', "AU::Test"); >+ >+ $schema->resultset('MessageQueue')->search({borrowernumber => $borrowernumber, status => 'sent'})->delete(); #clear borrower queue >+ C4::Letters::EnqueueLetter($my_message); >+ C4::Letters::SendQueuedMessages(); >+ >+ $sms_message_address = $schema->resultset('MessageQueue')->search({ >+ borrowernumber => $borrowernumber, >+ status => 'sent' >+ })->next()->to_address(); >+ is( $sms_message_address, '5555555555', 'SendQueuedMessages populates the to address correctly for SMS by SMS::Send driver to smsalertnumber when to_address is set incorrectly' ); >+ > }; > > subtest 'get_item_content' => sub { >-- >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 30838
:
135298
|
135299
|
136674
|
136675
|
136676
|
137202
|
138025
|
138026
|
138027
|
138028
|
138052