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 => 73; |
21 |
use Test::More tests => 74; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
Lines 104-110
is( $message_id, undef, 'EnqueueLetter without the letter argument returns undef
Link Here
|
104 |
|
104 |
|
105 |
delete $my_message->{message_transport_type}; |
105 |
delete $my_message->{message_transport_type}; |
106 |
$my_message->{letter} = { |
106 |
$my_message->{letter} = { |
107 |
content => 'a message', |
107 |
content => 'a message:__MESSAGE_ID__', |
108 |
title => 'message title', |
108 |
title => 'message title', |
109 |
metadata => 'metadata', |
109 |
metadata => 'metadata', |
110 |
code => 'TEST_MESSAGE', |
110 |
code => 'TEST_MESSAGE', |
Lines 128-134
is( @$messages, 1, 'one message stored for the borrower' );
Link Here
|
128 |
is( $messages->[0]->{message_id}, $message_id, 'EnqueueLetter returns the message id correctly' ); |
128 |
is( $messages->[0]->{message_id}, $message_id, 'EnqueueLetter returns the message id correctly' ); |
129 |
is( $messages->[0]->{borrowernumber}, $borrowernumber, 'EnqueueLetter stores the borrower number correctly' ); |
129 |
is( $messages->[0]->{borrowernumber}, $borrowernumber, 'EnqueueLetter stores the borrower number correctly' ); |
130 |
is( $messages->[0]->{subject}, $my_message->{letter}->{title}, 'EnqueueLetter stores the subject correctly' ); |
130 |
is( $messages->[0]->{subject}, $my_message->{letter}->{title}, 'EnqueueLetter stores the subject correctly' ); |
131 |
is( $messages->[0]->{content}, $my_message->{letter}->{content}, 'EnqueueLetter stores the content correctly' ); |
131 |
is( @{[ split( /:/, $messages->[0]->{content} ) ]}[0], @{[ split( /:/, $my_message->{letter}->{content} ) ]}[0], 'EnqueueLetter stores the content correctly' ); |
|
|
132 |
ok( @{[ split( /:/, $messages->[0]->{content} ) ]}[1] =~ /^\d+$/, 'Content __MESSAGE_ID__ is replaced with an actual integer id' ); |
132 |
is( $messages->[0]->{message_transport_type}, $my_message->{message_transport_type}, 'EnqueueLetter stores the message type correctly' ); |
133 |
is( $messages->[0]->{message_transport_type}, $my_message->{message_transport_type}, 'EnqueueLetter stores the message type correctly' ); |
133 |
is( $messages->[0]->{status}, 'pending', 'EnqueueLetter stores the status pending correctly' ); |
134 |
is( $messages->[0]->{status}, 'pending', 'EnqueueLetter stores the status pending correctly' ); |
134 |
isnt( $messages->[0]->{time_queued}, undef, 'Time queued inserted by default in message_queue table' ); |
135 |
isnt( $messages->[0]->{time_queued}, undef, 'Time queued inserted by default in message_queue table' ); |
135 |
- |
|
|