X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2Fdb_dependent%2FLetters.t;h=d8e96a6a7ade32c6268b265899cba0bd38a97b7d;hb=8a0e21f0ecfd7e5bd135ad30e8955960b5d3549d;hp=26716c56189d6752d05b17f0eca6c0a6d2873e24;hpb=58bc11a7d4e50d1f2ce7b09dbb512f3a576f5a61;p=koha.git diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t index 26716c5618..d8e96a6a7a 100644 --- a/t/db_dependent/Letters.t +++ b/t/db_dependent/Letters.t @@ -18,7 +18,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 77; +use Test::More tests => 76; use Test::MockModule; use Test::Warn; @@ -176,7 +176,6 @@ Look at this wonderful biblio timestamp: <>. $dbh->do( q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES (?,'my module','my code','my name',1,?,?,'email')|, undef, $library->{branchcode}, $title, $content ); $letters = C4::Letters::GetLetters(); is( @$letters, 1, 'GetLetters returns the correct number of letters' ); -is( $letters->[0]->{branchcode}, $library->{branchcode}, 'GetLetters gets the branch code correctly' ); is( $letters->[0]->{module}, 'my module', 'GetLetters gets the module correctly' ); is( $letters->[0]->{code}, 'my code', 'GetLetters gets the code correctly' ); is( $letters->[0]->{name}, 'my name', 'GetLetters gets the name correctly' ); @@ -633,7 +632,7 @@ subtest 'TranslateNotices' => sub { subtest 'SendQueuedMessages' => sub { - plan tests => 2; + plan tests => 3; t::lib::Mocks::mock_preference( 'SMSSendDriver', 'Email' ); my $patron = Koha::Patrons->find($borrowernumber); $dbh->do(q| @@ -652,7 +651,17 @@ subtest 'SendQueuedMessages' => sub { borrowernumber => $borrowernumber, status => 'sent' })->next()->to_address(); - is( $sms_message_address, '5555555555@kidclamp.rocks', 'SendQueuedMessages populates the to address correctly for SMS by email' ); + is( $sms_message_address, '5555555555@kidclamp.rocks', 'SendQueuedMessages populates the to address correctly for SMS by email when to_address not set' ); + $schema->resultset('MessageQueue')->search({borrowernumber => $borrowernumber,status => 'sent'})->delete(); #clear borrower queue + $my_message->{to_address} = 'fixme@kidclamp.iswrong'; + $message_id = 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@kidclamp.rocks', 'SendQueuedMessages populates the to address correctly for SMS by email when to_address is set incorrectly' ); + }; subtest 'get_item_content' => sub {