Lines 949-964
subtest 'Test message_id parameter for SendQueuedMessages' => sub {
Link Here
|
949 |
'borrowernumber' => $borrowernumber, |
949 |
'borrowernumber' => $borrowernumber, |
950 |
'to_address' => 'to@example.org', |
950 |
'to_address' => 'to@example.org', |
951 |
'message_transport_type' => 'email', |
951 |
'message_transport_type' => 'email', |
952 |
'from_address' => 'root@localhost.' # invalid KohaAdminEmailAddress |
952 |
'from_address' => '@example.com' # invalid from_address |
953 |
}; |
953 |
}; |
954 |
my $message_id = C4::Letters::EnqueueLetter($my_message); |
954 |
my $message_id = C4::Letters::EnqueueLetter($my_message); |
955 |
my $processed = C4::Letters::SendQueuedMessages( { message_id => $message_id } ); |
955 |
my $processed = C4::Letters::SendQueuedMessages( { message_id => $message_id } ); |
956 |
is( $processed, 1, 'Processed 1 message when one message_id passed' ); |
956 |
is( $processed, 1, 'Processed 1 message when one message_id passed' ); |
957 |
my $message_1 = C4::Letters::GetMessage($message_id); |
957 |
my $message_1 = C4::Letters::GetMessage($message_id); |
958 |
is( $message_1->{status}, 'failed', 'Invalid KohaAdminEmailAddress => status failed' ); |
958 |
is( $message_1->{status}, 'failed', 'Invalid from_address => status failed' ); |
959 |
is( $message_1->{failure_code}, 'INVALID_EMAIL', 'Failure code set correctly for invalid email parameter'); |
959 |
is( $message_1->{failure_code}, 'INVALID_EMAIL:from', 'Failure code set correctly for invalid email parameter'); |
960 |
|
960 |
|
961 |
$my_message->{from_address} = 'root@example.org'; # valid KohaAdminEmailAddress |
961 |
$my_message->{from_address} = 'root@example.org'; # valid from_address |
962 |
$message_id = C4::Letters::EnqueueLetter($my_message); |
962 |
$message_id = C4::Letters::EnqueueLetter($my_message); |
963 |
warning_like { C4::Letters::SendQueuedMessages( { message_id => $message_id } ); } |
963 |
warning_like { C4::Letters::SendQueuedMessages( { message_id => $message_id } ); } |
964 |
qr|Fake send_or_die|, |
964 |
qr|Fake send_or_die|, |
Lines 966-970
subtest 'Test message_id parameter for SendQueuedMessages' => sub {
Link Here
|
966 |
$message_1 = C4::Letters::GetMessage($message_1->{message_id}); |
966 |
$message_1 = C4::Letters::GetMessage($message_1->{message_id}); |
967 |
my $message_2 = C4::Letters::GetMessage($message_id); |
967 |
my $message_2 = C4::Letters::GetMessage($message_id); |
968 |
is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' ); |
968 |
is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' ); |
969 |
is( $message_2->{status}, 'sent', 'Valid KohaAdminEmailAddress => status sent' ); |
969 |
is( $message_2->{status}, 'sent', 'Valid from_address => status sent' ); |
970 |
}; |
970 |
}; |
971 |
- |
|
|