From b1e78d530a38d3edc04168d22671624589d6bbcc Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 17 May 2017 12:58:09 -0400 Subject: [PATCH] Bug 18478 - Unit tests Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- t/db_dependent/Letters.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t index f3bb8bf149..7950750c30 100644 --- a/t/db_dependent/Letters.t +++ b/t/db_dependent/Letters.t @@ -606,7 +606,7 @@ subtest 'TranslateNotices' => sub { subtest 'SendQueuedMessages' => sub { - plan tests => 1; + plan tests => 2; t::lib::Mocks::mock_preference( 'SMSSendDriver', 'Email' ); my $patron = Koha::Patrons->find($borrowernumber); $dbh->do(q| @@ -617,4 +617,14 @@ subtest 'SendQueuedMessages' => sub { eval { C4::Letters::SendQueuedMessages(); }; is( $@, '', 'SendQueuedMessages should not explode if the patron does not have a sms provider set' ); + my $sms_pro = $builder->build_object({ class => 'Koha::SMS::Providers', value => { domain => 'kidclamp.rocks' } }); + ModMember( borrowernumber => $borrowernumber, smsalertnumber => '5555555555', sms_provider_id => $sms_pro->id() ); + $message_id = C4::Letters::EnqueueLetter($my_message); #using datas set around line 95 and forward + C4::Letters::SendQueuedMessages(); + my $sms_message_address = $schema->resultset('MessageQueue')->search({ + borrowernumber => $borrowernumber, + status => 'sent' + })->next()->to_address(); + is( $sms_message_address, '5555555555@kidclamp.rocks', 'SendQueuedMessages populates the to address correctly for SMS by email' ); + }; -- 2.39.5