Bugzilla – Attachment 63506 Details for
Bug 18478
Some notices sent via SMS gateway fail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18478 - Additional unit tests
Bug-18478---Additional-unit-tests.patch (text/plain), 3.27 KB, created by
Nick Clemens (kidclamp)
on 2017-05-17 17:02:22 UTC
(
hide
)
Description:
Bug 18478 - Additional unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-05-17 17:02:22 UTC
Size:
3.27 KB
patch
obsolete
>From 7301bde2f99b4d5bf3e62a20355ab2ed320b9be4 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 16 May 2017 11:01:02 -0400 >Subject: [PATCH] Bug 18478 - Additional unit tests > >This method was not previously covered, we don't change it , but >no reason to throw away these tests to ensure messages are created >as expected > >To test: >1 - Apply this patch first >2 - Prove t/db_dependent/Reserves.t >3 - Last tests fail >4 - Apply other patch >5 - All tests should pass >--- > t/db_dependent/Reserves.t | 64 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 63 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 4c027b1..0ac07f3 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 71; >+use Test::More tests => 72; > use Test::MockModule; > use Test::Warn; > >@@ -36,6 +36,7 @@ use Koha::Caches; > use Koha::DateUtils; > use Koha::Holds; > use Koha::Libraries; >+use Koha::Notice::Templates; > use Koha::Patron::Categories; > > BEGIN { >@@ -716,6 +717,67 @@ $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); > # we reached the finish > $schema->storage->txn_rollback(); > >+subtest '_koha_notify_reserve() tests' => sub { >+ >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ my $wants_hold_and_email = { >+ wants_digest => '0', >+ transports => { >+ sms => 'HOLD', >+ email => 'HOLD', >+ }, >+ letter_code => 'HOLD' >+ }; >+ >+ my $mp = Test::MockModule->new( 'C4::Members::Messaging' ); >+ $mp->mock("GetMessagingPreferences",$wants_hold_and_email); >+ >+ my $sms_hold_notice = $builder->build_object({ >+ class => 'Koha::Notice::Templates', >+ value => { >+ message_transport_type => 'sms', >+ branchcode => '', >+ code => 'HOLD', >+ } >+ }); >+ >+ my $hold_borrower = $builder->build({ >+ source => 'Borrower', >+ value => { >+ smsalertnumber=>'5555555555', >+ email=>'a@b.com', >+ } >+ })->{borrowernumber}; >+ >+ my $hold = $builder->build({ >+ source => 'Reserve', >+ value => { >+ borrowernumber=>$hold_borrower >+ } >+ }); >+ >+ ModReserveAffect($hold->{itemnumber}, $hold->{borrowernumber}, 0); >+ my $sms_message_address = $schema->resultset('MessageQueue')->search({ >+ letter_code => 'HOLD', >+ message_transport_type => 'sms', >+ borrowernumber => $hold_borrower, >+ })->next()->to_address(); >+ is($sms_message_address, undef ,"We should not populate the sms message with the sms number, sending will do so"); >+ >+ my $email_message_address = $schema->resultset('MessageQueue')->search({ >+ letter_code => 'HOLD', >+ message_transport_type => 'email', >+ borrowernumber => $hold_borrower, >+ })->next()->to_address(); >+ is($email_message_address, undef ,"We should not populate the hold message with the email address, sending will do so"); >+ >+ $schema->storage->txn_rollback(); >+ >+}; >+ > sub count_hold_print_messages { > my $message_count = $dbh->selectall_arrayref(q{ > SELECT COUNT(*) >-- >2.1.4
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 18478
:
63487
|
63488
|
63504
|
63505
|
63506
|
63674
|
63675
|
63734
|
63735
|
63736
|
63737
|
63738
|
63983
|
63984
|
63985