@@ -, +, @@ --- t/db_dependent/Letters.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/t/db_dependent/Letters.t +++ a/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' ); + }; --