|
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 => 82; |
21 |
use Test::More tests => 83; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
use Test::Exception; |
24 |
use Test::Exception; |
|
Lines 146-152
is( $messages->[0]->{message_transport_type}, $my_message->{message_transport_ty
Link Here
|
| 146 |
is( $messages->[0]->{status}, 'pending', 'EnqueueLetter stores the status pending correctly' ); |
146 |
is( $messages->[0]->{status}, 'pending', 'EnqueueLetter stores the status pending correctly' ); |
| 147 |
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' ); |
| 148 |
is( $messages->[0]->{updated_on}, $messages->[0]->{time_queued}, 'Time status changed equals time queued when created in message_queue table' ); |
148 |
is( $messages->[0]->{updated_on}, $messages->[0]->{time_queued}, 'Time status changed equals time queued when created in message_queue table' ); |
| 149 |
is( $messages->[0]->{delivery_note}, '', 'Delivery note for successful message correctly empty'); |
149 |
is( $messages->[0]->{failure_code}, '', 'Failure code for successful message correctly empty'); |
| 150 |
|
150 |
|
| 151 |
# Setting time_queued to something else than now |
151 |
# Setting time_queued to something else than now |
| 152 |
my $yesterday = dt_from_string->subtract( days => 1 ); |
152 |
my $yesterday = dt_from_string->subtract( days => 1 ); |
|
Lines 163-168
is(
Link Here
|
| 163 |
'failed', |
163 |
'failed', |
| 164 |
'message marked failed if tried to send SMS message for borrower with no smsalertnumber set (bug 11208)' |
164 |
'message marked failed if tried to send SMS message for borrower with no smsalertnumber set (bug 11208)' |
| 165 |
); |
165 |
); |
|
|
166 |
is( |
| 167 |
$messages->[0]->{failure_code}, |
| 168 |
'MISSING_SMS', |
| 169 |
'Correct failure code set for borrower with no smsalertnumber set' |
| 170 |
); |
| 166 |
isnt($messages->[0]->{updated_on}, $messages->[0]->{time_queued}, 'Time status changed differs from time queued when status changes' ); |
171 |
isnt($messages->[0]->{updated_on}, $messages->[0]->{time_queued}, 'Time status changed differs from time queued when status changes' ); |
| 167 |
is(dt_from_string($messages->[0]->{time_queued}), $yesterday, 'Time queued remaines inmutable' ); |
172 |
is(dt_from_string($messages->[0]->{time_queued}), $yesterday, 'Time queued remaines inmutable' ); |
| 168 |
|
173 |
|
|
Lines 177-185
$resent = C4::Letters::ResendMessage();
Link Here
|
| 177 |
is( $resent, undef, 'ResendMessage should return undef if not message_id given' ); |
182 |
is( $resent, undef, 'ResendMessage should return undef if not message_id given' ); |
| 178 |
|
183 |
|
| 179 |
# Delivery notes |
184 |
# Delivery notes |
| 180 |
is($messages->[0]->{delivery_note}, 'Missing SMS number', |
185 |
is( $messages->[0]->{failure_code}, 'MISSING_SMS', 'Failure code set correctly for no smsalertnumber correctly set' ); |
| 181 |
'Delivery note for no smsalertnumber correctly set'); |
|
|
| 182 |
|
| 183 |
|
186 |
|
| 184 |
# GetLetters |
187 |
# GetLetters |
| 185 |
my $letters = C4::Letters::GetLetters(); |
188 |
my $letters = C4::Letters::GetLetters(); |
| 186 |
- |
|
|