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 => 83; |
21 |
use Test::More tests => 84; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
Lines 116-122
is( $message_id, undef, 'EnqueueLetter without the letter argument returns undef
Link Here
|
116 |
|
116 |
|
117 |
delete $my_message->{message_transport_type}; |
117 |
delete $my_message->{message_transport_type}; |
118 |
$my_message->{letter} = { |
118 |
$my_message->{letter} = { |
119 |
content => 'I ♥ Koha', |
119 |
content => 'I ♥ Koha:__MESSAGE_ID__', |
120 |
title => '啤酒 is great', |
120 |
title => '啤酒 is great', |
121 |
metadata => 'metadata', |
121 |
metadata => 'metadata', |
122 |
code => 'TEST_MESSAGE', |
122 |
code => 'TEST_MESSAGE', |
Lines 140-146
is( @$messages, 1, 'one message stored for the borrower' );
Link Here
|
140 |
is( $messages->[0]->{message_id}, $message_id, 'EnqueueLetter returns the message id correctly' ); |
140 |
is( $messages->[0]->{message_id}, $message_id, 'EnqueueLetter returns the message id correctly' ); |
141 |
is( $messages->[0]->{borrowernumber}, $borrowernumber, 'EnqueueLetter stores the borrower number correctly' ); |
141 |
is( $messages->[0]->{borrowernumber}, $borrowernumber, 'EnqueueLetter stores the borrower number correctly' ); |
142 |
is( $messages->[0]->{subject}, $my_message->{letter}->{title}, 'EnqueueLetter stores the subject correctly' ); |
142 |
is( $messages->[0]->{subject}, $my_message->{letter}->{title}, 'EnqueueLetter stores the subject correctly' ); |
143 |
is( $messages->[0]->{content}, $my_message->{letter}->{content}, 'EnqueueLetter stores the content correctly' ); |
143 |
is( @{[ split( /:/, $messages->[0]->{content} ) ]}[0], @{[ split( /:/, $my_message->{letter}->{content} ) ]}[0], 'EnqueueLetter stores the content correctly' ); |
|
|
144 |
ok( @{[ split( /:/, $messages->[0]->{content} ) ]}[1] =~ /^\d+$/, 'Content __MESSAGE_ID__ is replaced with an actual integer id' ); |
144 |
is( $messages->[0]->{message_transport_type}, $my_message->{message_transport_type}, 'EnqueueLetter stores the message type correctly' ); |
145 |
is( $messages->[0]->{message_transport_type}, $my_message->{message_transport_type}, 'EnqueueLetter stores the message type correctly' ); |
145 |
is( $messages->[0]->{status}, 'pending', 'EnqueueLetter stores the status pending correctly' ); |
146 |
is( $messages->[0]->{status}, 'pending', 'EnqueueLetter stores the status pending correctly' ); |
146 |
isnt( $messages->[0]->{time_queued}, undef, 'Time queued inserted by default in message_queue table' ); |
147 |
isnt( $messages->[0]->{time_queued}, undef, 'Time queued inserted by default in message_queue table' ); |
147 |
- |
|
|