# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
-use Test::More tests => 76;
+use Test::More tests => 75;
use Test::MockModule;
use Test::Warn;
# SendQueuedMessages
-my $messages_processed = C4::Letters::SendQueuedMessages();
-is($messages_processed, 1, 'all queued messages processed');
+my $messages_processed = C4::Letters::SendQueuedMessages( { type => 'email' });
+is($messages_processed, 0, 'No queued messages processed if type limit passed with unused type');
+$messages_processed = C4::Letters::SendQueuedMessages( { type => 'sms' });
+is($messages_processed, 1, 'All queued messages processed, found correct number of messages with type limit');
$messages = C4::Letters::GetQueuedMessages({ borrowernumber => $borrowernumber });
is(
$messages->[0]->{status},
is( $letter14206_c->{message_transport_type}, 'print', 'Bug 14206 - correct mtt detected for call from overdue_notices.pl' );
# addalert
-my $type = 'my type';
my $externalid = 'my external id';
-my $alert_id = C4::Letters::addalert($borrowernumber, $type, $externalid);
+my $alert_id = C4::Letters::addalert($borrowernumber, $externalid);
isnt( $alert_id, undef, 'addalert does not return undef' );
$alerts = C4::Letters::getalert($borrowernumber);
is( @$alerts, 1, 'addalert adds an alert' );
is( $alerts->[0]->{alertid}, $alert_id, 'addalert returns the alert id correctly' );
-is( $alerts->[0]->{type}, $type, 'addalert stores the type correctly' );
is( $alerts->[0]->{externalid}, $externalid, 'addalert stores the externalid correctly' );
-$alerts = C4::Letters::getalert($borrowernumber, $type);
+$alerts = C4::Letters::getalert($borrowernumber);
is( @$alerts, 1, 'getalert returns the correct number of alerts' );
-$alerts = C4::Letters::getalert($borrowernumber, $type, $externalid);
+$alerts = C4::Letters::getalert($borrowernumber, $externalid);
is( @$alerts, 1, 'getalert returns the correct number of alerts' );
-$alerts = C4::Letters::getalert($borrowernumber, 'another type');
-is( @$alerts, 0, 'getalert returns the correct number of alerts' );
-$alerts = C4::Letters::getalert($borrowernumber, $type, 'another external id');
+$alerts = C4::Letters::getalert($borrowernumber, 'another external id');
is( @$alerts, 0, 'getalert returns the correct number of alerts' );
dateofbirth => $date,
email => 'john.smith@test.de',
);
-my $alert_id = C4::Letters::addalert($borrowernumber, 'issue', $subscriptionid);
+my $alert_id = C4::Letters::addalert($borrowernumber, $subscriptionid);
my $err2;