Lines 18-24
Link Here
|
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use Test::More tests => 76; |
21 |
use Test::More tests => 77; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
Lines 749-751
subtest 'Test limit parameter for SendQueuedMessages' => sub {
Link Here
|
749 |
is( $messages_processed, 2, |
749 |
is( $messages_processed, 2, |
750 |
'Processed 2 message with limit of 3 and 2 unprocessed messages' ); |
750 |
'Processed 2 message with limit of 3 and 2 unprocessed messages' ); |
751 |
}; |
751 |
}; |
752 |
- |
752 |
|
|
|
753 |
subtest 'Test canary call for SendQueuedMessages' => sub { |
754 |
plan tests => 2; |
755 |
|
756 |
my $letter = { |
757 |
'letter' => { |
758 |
'content' => 'a message', |
759 |
'metadata' => 'metadata', |
760 |
'code' => 'TEST_MESSAGE', |
761 |
'content_type' => 'text/plain', |
762 |
'title' => 'message title' |
763 |
}, |
764 |
'borrowernumber' => $borrowernumber, |
765 |
'to_address' => undef, |
766 |
'message_transport_type' => 'email', |
767 |
'from_address' => 'from@example.com' |
768 |
}; |
769 |
C4::Letters::EnqueueLetter($letter); |
770 |
|
771 |
my $mocked_storing = Test::MockModule->new('Koha::Object'); |
772 |
$mocked_storing->mock('store' => sub { return; }); |
773 |
$messages_processed = C4::Letters::SendQueuedMessages(); |
774 |
is( $messages_processed, undef, 'Bad store should prevent sending any.'); |
775 |
$mocked_storing->unmock('store'); |
776 |
$messages_processed = C4::Letters::SendQueuedMessages(); |
777 |
is( $messages_processed, 1, 'Good store should send.'); |
778 |
|
779 |
} |