Bugzilla – Attachment 63488 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 - Unit tests
Bug-18478---Unit-tests.patch (text/plain), 3.08 KB, created by
Nick Clemens (kidclamp)
on 2017-05-16 15:02:36 UTC
(
hide
)
Description:
Bug 18478 - Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-05-16 15:02:36 UTC
Size:
3.08 KB
patch
obsolete
>From 9d24c0e4b8de8f20d116ddbfb3d7040808ce128f 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 - Unit tests > >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..31d47527 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, "5555555555","We should populate the sms message with the sms number"); >+ >+ 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, 'a@b.com',"We should populate the hold message with the email address"); >+ >+ $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