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 => 80; |
21 |
use Test::More tests => 81; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
Lines 99-105
is( $message_id, undef, 'EnqueueLetter without the letter argument returns undef
Link Here
|
99 |
|
99 |
|
100 |
delete $my_message->{message_transport_type}; |
100 |
delete $my_message->{message_transport_type}; |
101 |
$my_message->{letter} = { |
101 |
$my_message->{letter} = { |
102 |
content => 'a message', |
102 |
content => 'a message:__MESSAGE_ID__', |
103 |
title => 'message title', |
103 |
title => 'message title', |
104 |
metadata => 'metadata', |
104 |
metadata => 'metadata', |
105 |
code => 'TEST_MESSAGE', |
105 |
code => 'TEST_MESSAGE', |
Lines 122-128
is( @$messages, 1, 'one message stored for the borrower' );
Link Here
|
122 |
is( $messages->[0]->{message_id}, $message_id, 'EnqueueLetter returns the message id correctly' ); |
122 |
is( $messages->[0]->{message_id}, $message_id, 'EnqueueLetter returns the message id correctly' ); |
123 |
is( $messages->[0]->{borrowernumber}, $borrowernumber, 'EnqueueLetter stores the borrower number correctly' ); |
123 |
is( $messages->[0]->{borrowernumber}, $borrowernumber, 'EnqueueLetter stores the borrower number correctly' ); |
124 |
is( $messages->[0]->{subject}, $my_message->{letter}->{title}, 'EnqueueLetter stores the subject correctly' ); |
124 |
is( $messages->[0]->{subject}, $my_message->{letter}->{title}, 'EnqueueLetter stores the subject correctly' ); |
125 |
is( $messages->[0]->{content}, $my_message->{letter}->{content}, 'EnqueueLetter stores the content correctly' ); |
125 |
is( @{[ split( /:/, $messages->[0]->{content} ) ]}->[0], @{[ split( /:/, $my_message->{letter}->{content} ) ]}->[0], 'EnqueueLetter stores the content correctly' ); |
|
|
126 |
ok( @{[ split( /:/, $messages->[0]->{content} ) ]}->[1] =~ /^\d+$/, 'Content __MESSAGE_ID__ is replaced with an actual integer id' ); |
126 |
is( $messages->[0]->{message_transport_type}, $my_message->{message_transport_type}, 'EnqueueLetter stores the message type correctly' ); |
127 |
is( $messages->[0]->{message_transport_type}, $my_message->{message_transport_type}, 'EnqueueLetter stores the message type correctly' ); |
127 |
is( $messages->[0]->{status}, 'pending', 'EnqueueLetter stores the status pending correctly' ); |
128 |
is( $messages->[0]->{status}, 'pending', 'EnqueueLetter stores the status pending correctly' ); |
128 |
|
129 |
|
129 |
- |
|
|