From da81704cf2ae81d6463ad10009b5e25a0d133c42 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 21 Jul 2023 16:05:11 +0000 Subject: [PATCH] Bug 29145: Replace GetDebarments in unit tests GetDebarments was removed and replaced by $patron->restrictions. The tests needed some adjustments to reflect that change. Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Circulation/MarkIssueReturned.t | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/t/db_dependent/Circulation/MarkIssueReturned.t b/t/db_dependent/Circulation/MarkIssueReturned.t index 71e32274fd..e6c08048d2 100755 --- a/t/db_dependent/Circulation/MarkIssueReturned.t +++ b/t/db_dependent/Circulation/MarkIssueReturned.t @@ -242,8 +242,8 @@ subtest 'AutoRemoveOverduesRestrictions' => sub { C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_1->itemnumber ); - $debarments = Koha::Patron::Debarments::GetDebarments({ borrowernumber => $patron->borrowernumber }); - is( scalar @$debarments, 0, 'OVERDUES debarment is removed if remaining items would not result in patron debarment' ); + $restrictions = $patron->restrictions; + is($restrictions->count, 0, 'OVERDUES debarment is removed if remaining items would not result in patron debarment' ); $checkout_1 = AddIssue( $patron->unblessed, $item_1->barcode, $ten_days_ago ); # overdue and would trigger debarment @@ -257,8 +257,8 @@ subtest 'AutoRemoveOverduesRestrictions' => sub { C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_2->itemnumber ); - $debarments = Koha::Patron::Debarments::GetDebarments({ borrowernumber => $patron->borrowernumber }); - is( $debarments->[0]->{type}, 'OVERDUES', 'OVERDUES debarment is not removed if patron still has overdues that would trigger debarment' ); + $restrictions = $patron->restrictions->search({ type => 'OVERDUES' }); + is( $restrictions->count, 1, 'OVERDUES debarment is not removed if patron still has overdues that would trigger debarment' ); my $eleven_days_ago = dt_from_string->subtract( days => 11 ); @@ -282,8 +282,8 @@ subtest 'AutoRemoveOverduesRestrictions' => sub { C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_2->itemnumber ); - $debarments = Koha::Patron::Debarments::GetDebarments({ borrowernumber => $patron->borrowernumber }); - is( scalar @$debarments, 0, 'OVERDUES debarment is removed if remaining items would not result in patron debarment' ); + $restrictions = $patron->restrictions; + is( $restrictions->count, 0, 'OVERDUES debarment is removed if remaining items would not result in patron debarment' ); $schema->storage->txn_rollback; }; -- 2.39.2