From f7537bc9388313bc3c328288cc961f81c9a7b30d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 8 Nov 2013 13:40:07 +0100 Subject: [PATCH] Bug 9016: (follow-up) fix unit tests The unit tests should insert overdue rules. + Fix the doc for GetOverdueMessageTransportTypes Signed-off-by: Olli-Antti Kivilahti Signed-off-by: Marcel de Rooy Signed-off-by: Galen Charlton --- C4/Overdues.pm | 2 +- t/db_dependent/Overdues.t | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index f9212f424d..66cb1084a1 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -911,7 +911,7 @@ sub RemoveNotifyLine { my $message_transport_types = GetOverdueMessageTransportTypes( $branchcode, $categorycode, $letternumber); - return a arrayref with message_transport_type for given branchcode, categorycode and letternumber(1,2 or 3) + return a arrayref with all message_transport_type for given branchcode, categorycode and letternumber(1,2 or 3) =cut sub GetOverdueMessageTransportTypes { diff --git a/t/db_dependent/Overdues.t b/t/db_dependent/Overdues.t index 2725565c9b..b023cfd2c6 100644 --- a/t/db_dependent/Overdues.t +++ b/t/db_dependent/Overdues.t @@ -14,12 +14,21 @@ $dbh->{RaiseError} = 1; $dbh->do(q|DELETE FROM letter|); $dbh->do(q|DELETE FROM message_queue|); $dbh->do(q|DELETE FROM message_transport_types|); +$dbh->do(q|DELETE FROM overduerules|); $dbh->do(q|DELETE FROM overduerules_transport_types|); $dbh->do(q| INSERT INTO message_transport_types( message_transport_type ) VALUES ('email'), ('phone'), ('print'), ('sms') |); +$dbh->do(q| + INSERT INTO overduerules ( branchcode, categorycode ) VALUES + ('CPL', 'PT'), + ('CPL', 'YA'), + ('', 'PT'), + ('', 'YA') +|); + $dbh->do(q| INSERT INTO overduerules_transport_types( branchcode, categorycode, letternumber, message_transport_type ) VALUES ('CPL', 'PT', 1, 'email'), @@ -53,7 +62,7 @@ is_deeply( $mtts, ['sms'], 'GetOverdueMessageTransportTypes: second overdue is b $mtts = C4::Overdues::GetOverdueMessageTransportTypes('CPL', 'PT', 3); is_deeply( $mtts, ['email'], 'GetOverdueMessageTransportTypes: third overdue is by email for PT (CPL)' ); -my $mtts = C4::Overdues::GetOverdueMessageTransportTypes('', 'PT', 1); +$mtts = C4::Overdues::GetOverdueMessageTransportTypes('', 'PT', 1); is_deeply( $mtts, ['email'], 'GetOverdueMessageTransportTypes: first overdue is by email for PT (default)' ); $mtts = C4::Overdues::GetOverdueMessageTransportTypes('', 'PT', 2); -- 2.39.5