Lines 751-753
subtest 'Test limit parameter for SendQueuedMessages' => sub {
Link Here
|
751 |
is( $messages_processed, 2, |
751 |
is( $messages_processed, 2, |
752 |
'Processed 2 message with limit of 3 and 2 unprocessed messages' ); |
752 |
'Processed 2 message with limit of 3 and 2 unprocessed messages' ); |
753 |
}; |
753 |
}; |
754 |
- |
754 |
|
|
|
755 |
subtest 'Test canary call for SendQueuedMessages' => sub { |
756 |
plan tests => 2; |
757 |
|
758 |
my $letter = { |
759 |
'letter' => { |
760 |
'content' => 'a message', |
761 |
'metadata' => 'metadata', |
762 |
'code' => 'TEST_MESSAGE', |
763 |
'content_type' => 'text/plain', |
764 |
'title' => 'message title' |
765 |
}, |
766 |
'borrowernumber' => $borrowernumber, |
767 |
'to_address' => undef, |
768 |
'message_transport_type' => 'email', |
769 |
'from_address' => 'from@example.com' |
770 |
}; |
771 |
C4::Letters::EnqueueLetter($letter); |
772 |
|
773 |
my $mocked_storing = Test::MockModule->new('Koha::Object'); |
774 |
$mocked_storing->mock('store' => sub { return; }); |
775 |
$messages_processed = C4::Letters::SendQueuedMessages(); |
776 |
is( $messages_processed, undef, 'Bad store should prevent sending any.'); |
777 |
$mocked_storing->unmock('store'); |
778 |
$messages_processed = C4::Letters::SendQueuedMessages(); |
779 |
is( $messages_processed, 1, 'Good store should send.'); |
780 |
|
781 |
} |