Bug 22908: Add tests
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 14 May 2019 17:21:57 +0000 (12:21 -0500)
committerroot <root@f1ebe1bec408>
Thu, 30 May 2019 10:02:44 +0000 (10:02 +0000)
Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

t/db_dependent/Suggestions.t

index 46d4582..4c2760e 100644 (file)
@@ -18,7 +18,7 @@
 use Modern::Perl;
 
 use DateTime::Duration;
-use Test::More tests => 109;
+use Test::More tests => 110;
 use Test::Warn;
 
 use t::lib::Mocks;
@@ -249,6 +249,13 @@ $messages = C4::Letters::GetQueuedMessages({
 });
 is ($messages->[0]->{message_transport_type}, 'email', 'When FallbackToSMSIfNoEmail syspref is enabled the suggestion message_transport_type is email if the borrower has an email');
 
+$mod_suggestion4->{manageddate} = 'invalid date!';
+ModSuggestion($mod_suggestion4);
+$messages = C4::Letters::GetQueuedMessages({
+    borrowernumber => $borrowernumber2
+});
+is (scalar(@$messages), 1, 'No new letter should have been generated if the update raised an error');
+
 is( GetSuggestionInfo(), undef, 'GetSuggestionInfo without the suggestion id returns undef' );
 $suggestion = GetSuggestionInfo($my_suggestionid);
 is( $suggestion->{suggestionid}, $my_suggestionid, 'GetSuggestionInfo returns the suggestion id correctly' );