Bug 36128: (QA follow-up) Add regression test

This patch adds a simple regression test to ensure we don't re-introduce
the errant warning.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2024-06-27 10:01:45 +01:00 committed by Katrin Fischer
parent 4c8586270a
commit 18c97c1456
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -1,7 +1,7 @@
#!/usr/bin/perl;
use Modern::Perl;
use Test::More tests => 17;
use Test::More tests => 18;
use Test::Warn;
use C4::Context;
@ -84,6 +84,11 @@ is_deeply( $mtts, ['print', 'sms', 'email'], 'GetOverdueMessageTransportTypes: t
# Test GetBranchcodesWithOverdueRules
$dbh->do(q|DELETE FROM overduerules|);
my @overdue_branches;
warnings_are { @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules(); } [],
"No warnings thrown when no overdue rules exist";
$dbh->do(q|
INSERT INTO overduerules
( branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3 )
@ -93,7 +98,7 @@ $dbh->do(q|
my @branchcodes = map { $_->branchcode } Koha::Libraries->search->as_list;
my @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules();
@overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules();
is_deeply( [ sort @overdue_branches ], [ sort @branchcodes ], 'If a default rule exists, all branches should be returned' );
$dbh->do(q|