Lines 282-288
HERE
Link Here
|
282 |
}; |
282 |
}; |
283 |
|
283 |
|
284 |
subtest 'set message_transport_types' => sub { |
284 |
subtest 'set message_transport_types' => sub { |
285 |
plan tests => 12; |
285 |
plan tests => 18; |
286 |
|
286 |
|
287 |
$schema->storage->txn_begin; |
287 |
$schema->storage->txn_begin; |
288 |
|
288 |
|
Lines 339-349
HERE
Link Here
|
339 |
}); |
339 |
}); |
340 |
is($stored_transports->count, 2, 'Two transports selected'); |
340 |
is($stored_transports->count, 2, 'Two transports selected'); |
341 |
|
341 |
|
342 |
# Test email and smsalertnumber validation |
342 |
# Test contact information validation |
343 |
eval { Koha::Patron::Message::Transport::Types->new({ |
343 |
eval { Koha::Patron::Message::Transport::Types->new({ |
344 |
message_transport_type => 'email' |
344 |
message_transport_type => 'email' |
345 |
})->store }; |
345 |
})->store }; |
346 |
eval { Koha::Patron::Message::Transport::Types->new({ |
346 |
eval { Koha::Patron::Message::Transport::Types->new({ |
|
|
347 |
message_transport_type => 'itiva' |
348 |
})->store }; |
349 |
eval { Koha::Patron::Message::Transport::Types->new({ |
350 |
message_transport_type => 'phone' |
351 |
})->store }; |
352 |
eval { Koha::Patron::Message::Transport::Types->new({ |
347 |
message_transport_type => 'sms' |
353 |
message_transport_type => 'sms' |
348 |
})->store }; |
354 |
})->store }; |
349 |
Koha::Patron::Message::Transport->new({ |
355 |
Koha::Patron::Message::Transport->new({ |
Lines 353-362
HERE
Link Here
|
353 |
})->store; |
359 |
})->store; |
354 |
Koha::Patron::Message::Transport->new({ |
360 |
Koha::Patron::Message::Transport->new({ |
355 |
message_attribute_id => $preference->message_attribute_id, |
361 |
message_attribute_id => $preference->message_attribute_id, |
|
|
362 |
message_transport_type => 'itiva', |
363 |
is_digest => 1 |
364 |
})->store; |
365 |
Koha::Patron::Message::Transport->new({ |
366 |
message_attribute_id => $preference->message_attribute_id, |
367 |
message_transport_type => 'phone', |
368 |
is_digest => 1 |
369 |
})->store; |
370 |
Koha::Patron::Message::Transport->new({ |
371 |
message_attribute_id => $preference->message_attribute_id, |
356 |
message_transport_type => 'sms', |
372 |
message_transport_type => 'sms', |
357 |
is_digest => 1 |
373 |
is_digest => 1 |
358 |
})->store; |
374 |
})->store; |
359 |
$patron->set({ email => '', smsalertnumber => '' })->store; |
375 |
t::lib::Mocks::mock_preference('TalkingTechItivaPhoneNotification', 0); |
|
|
376 |
$patron->set({ email => '', phone => '', smsalertnumber => '' })->store; |
360 |
eval { |
377 |
eval { |
361 |
$preference->message_transport_types('email')->store; |
378 |
$preference->message_transport_types('email')->store; |
362 |
}; |
379 |
}; |
Lines 368-373
HERE
Link Here
|
368 |
is ($@->borrowernumber, $patron->borrowernumber, 'The previous exception ' |
385 |
is ($@->borrowernumber, $patron->borrowernumber, 'The previous exception ' |
369 |
.' tells us which patron it was.'); |
386 |
.' tells us which patron it was.'); |
370 |
eval { |
387 |
eval { |
|
|
388 |
$preference->message_transport_types('itiva')->store; |
389 |
}; |
390 |
is (ref $@, 'Koha::Exceptions::Patron::Message::Preference::TalkingTechItivaPhoneNotificationRequired', |
391 |
'Adding a message preference with invalid message_transport_type' |
392 |
.' => Koha::Exceptions::Patron::Message::Preference::TalkingTechItivaPhoneNotificationRequired'); |
393 |
is ($@->message_name, $preference->message_name, 'The previous exception ' |
394 |
.' tells us it which message name it was.'); |
395 |
is ($@->borrowernumber, $patron->borrowernumber, 'The previous exception ' |
396 |
.' tells us which patron it was.'); |
397 |
eval { |
398 |
$preference->message_transport_types('phone')->store; |
399 |
}; |
400 |
is (ref $@, 'Koha::Exceptions::Patron::Message::Preference::PhoneNumberRequired', |
401 |
'Adding a message preference with invalid message_transport_type' |
402 |
.' => Koha::Exceptions::Patron::Message::Preference::PhoneNumberRequired'); |
403 |
is ($@->message_name, $preference->message_name, 'The previous exception ' |
404 |
.' tells us it which message name it was.'); |
405 |
is ($@->borrowernumber, $patron->borrowernumber, 'The previous exception ' |
406 |
.' tells us which patron it was.'); |
407 |
eval { |
371 |
$preference->message_transport_types('sms')->store; |
408 |
$preference->message_transport_types('sms')->store; |
372 |
}; |
409 |
}; |
373 |
is (ref $@, 'Koha::Exceptions::Patron::Message::Preference::SMSNumberRequired', |
410 |
is (ref $@, 'Koha::Exceptions::Patron::Message::Preference::SMSNumberRequired', |
374 |
- |
|
|