Bugzilla – Attachment 105207 Details for
Bug 24413
MarkLostItemsAsReturned functionality does not lift restrictions caused by long overdues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24413: Add tests
Bug-24413-Add-tests.patch (text/plain), 2.85 KB, created by
Katrin Fischer
on 2020-05-21 14:30:24 UTC
(
hide
)
Description:
Bug 24413: Add tests
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-05-21 14:30:24 UTC
Size:
2.85 KB
patch
obsolete
>From d939aad6505dd4e18bdf2c31ff8f054b32e0a989 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 13 May 2020 15:18:29 +0200 >Subject: [PATCH] Bug 24413: Add tests > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Circulation/MarkIssueReturned.t | 38 +++++++++++++++++++++++++- > 1 file changed, 37 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation/MarkIssueReturned.t b/t/db_dependent/Circulation/MarkIssueReturned.t >index 26c8a06291..af455e1349 100644 >--- a/t/db_dependent/Circulation/MarkIssueReturned.t >+++ b/t/db_dependent/Circulation/MarkIssueReturned.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::Exception; > > use t::lib::Mocks; >@@ -27,8 +27,10 @@ use C4::Circulation; > use C4::Context; > use Koha::Checkouts; > use Koha::Database; >+use Koha::DateUtils qw(dt_from_string); > use Koha::Old::Checkouts; > use Koha::Patrons; >+use Koha::Patron::Debarments; > > my $schema = Koha::Database->schema; > my $builder = t::lib::TestBuilder->new; >@@ -188,3 +190,37 @@ subtest 'Manually pass a return date' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'AutoRemoveOverduesRestrictions' => sub { >+ plan tests => 2; >+ >+ t::lib::Mocks::mock_preference('AutoRemoveOverduesRestrictions', 1); >+ >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ t::lib::Mocks::mock_userenv( { branchcode => $patron->branchcode } ); >+ my $item_1 = $builder->build_sample_item; >+ my $item_2 = $builder->build_sample_item; >+ my $item_3 = $builder->build_sample_item; >+ my $five_days_ago = dt_from_string->subtract( days => 5 ); >+ my $checkout_1 = AddIssue( $patron->unblessed, $item_1->barcode, $five_days_ago ); # overdue >+ my $checkout_2 = AddIssue( $patron->unblessed, $item_2->barcode, $five_days_ago ); # overdue >+ my $checkout_3 = AddIssue( $patron->unblessed, $item_3->barcode ); # not overdue >+ >+ Koha::Patron::Debarments::AddUniqueDebarment( >+ { >+ borrowernumber => $patron->borrowernumber, >+ type => 'OVERDUES', >+ comment => "OVERDUES_PROCESS simulation", >+ } >+ ); >+ >+ 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' ); >+ >+ 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' ); >+}; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24413
:
99111
|
99369
|
102606
|
102607
|
104843
|
104844
|
104845
|
104859
|
104860
|
104861
|
105205
|
105206
| 105207 |
105323