From 03bb1436ab8fa7a2c3d89c1c3fbf31fd53186fc8 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 25 Aug 2022 09:11:13 +0100 Subject: [PATCH] Bug 31095: Remove GetDebarments from MarkIssueReturned.t This patch removes GetDebarments from Ciculation/MarkIssueReturned.t Test plan 1. Confirm t/db_dependent/Circulation/MarkIssueReturned.t passes prior to the patch 2. Confirm t/db_dependent/Circulation/MarkIssueReturned.t passes after the patch 3. Confirm no tests have been removed Signed-off-by: Nick Clemens --- t/db_dependent/Circulation/MarkIssueReturned.t | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/t/db_dependent/Circulation/MarkIssueReturned.t b/t/db_dependent/Circulation/MarkIssueReturned.t index 654ac37451..fc939a2486 100755 --- a/t/db_dependent/Circulation/MarkIssueReturned.t +++ b/t/db_dependent/Circulation/MarkIssueReturned.t @@ -30,7 +30,7 @@ use Koha::Database; use Koha::DateUtils qw(dt_from_string); use Koha::Old::Checkouts; use Koha::Patrons; -use Koha::Patron::Debarments qw( GetDebarments AddUniqueDebarment ); +use Koha::Patron::Debarments qw( AddUniqueDebarment ); my $schema = Koha::Database->schema; my $builder = t::lib::TestBuilder->new; @@ -199,13 +199,14 @@ subtest 'AutoRemoveOverduesRestrictions' => sub { C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_1->itemnumber ); - my $debarments = Koha::Patron::Debarments::GetDebarments({ borrowernumber => $patron->borrowernumber }); - is( $debarments->[0]->{type}, 'OVERDUES', 'OVERDUES debarment is not removed if patron still has overdues' ); + my $restrictions = $patron->restrictions; + my $THE_restriction = $restrictions->next; + is( $THE_restriction->type->code, 'OVERDUES', 'OVERDUES debarment is not removed if patron still has overdues' ); 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 patron does not have overdues' ); + $restrictions = $patron->restrictions; + is( $restrictions->count, 0, 'OVERDUES debarment is removed if patron does not have overdues' ); $schema->storage->txn_rollback; }; -- 2.20.1