Bugzilla – Attachment 194253 Details for
Bug 41960
Add option to block placing hold when patron has overdues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41960: Unit tests
Bug-41960-Unit-tests.patch (text/plain), 2.05 KB, created by
Janusz Kaczmarek
on 2026-03-01 22:33:36 UTC
(
hide
)
Description:
Bug 41960: Unit tests
Filename:
MIME Type:
Creator:
Janusz Kaczmarek
Created:
2026-03-01 22:33:36 UTC
Size:
2.05 KB
patch
obsolete
>From 334791548eeb9f2add3c0710577f6a6f5234a86a Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Sun, 1 Mar 2026 22:30:41 +0000 >Subject: [PATCH] Bug 41960: Unit tests > >--- > t/db_dependent/Koha/Patron.t | 38 +++++++++++++++++++++++++++++++++++- > 1 file changed, 37 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t >index 44802ce4ba..a1d2f4ab11 100755 >--- a/t/db_dependent/Koha/Patron.t >+++ b/t/db_dependent/Koha/Patron.t >@@ -3176,7 +3176,7 @@ subtest 'ill_requests() tests' => sub { > > subtest 'can_place_holds() tests' => sub { > >- plan tests => 7; >+ plan tests => 8; > > subtest "'expired' tests" => sub { > >@@ -3344,6 +3344,42 @@ subtest 'can_place_holds() tests' => sub { > $schema->storage->txn_rollback; > }; > >+ subtest "'overdues' tests" => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ # Add a patron, making sure it is not (yet) expired >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+ # Add an overdue issue >+ my $item = $builder->build_sample_item; >+ my $ago = dt_from_string->subtract( days => 2 ); >+ $builder->build_object( >+ { >+ class => 'Koha::Checkouts', >+ value => >+ { borrowernumber => $patron->borrowernumber, itemnumber => $item->itemnumber, date_due => $ago } >+ } >+ ); >+ >+ t::lib::Mocks::mock_preference( 'OverduesBlockHolds', 'noblock' ); >+ >+ ok( $patron->can_place_holds(), "Has overdues, can place holds" ); >+ >+ t::lib::Mocks::mock_preference( 'OverduesBlockHolds', 'block' ); >+ >+ my $result = $patron->can_place_holds(); >+ ok( !$result, 'Has overdues, cannot place holds' ); >+ >+ my $messages = $result->messages(); >+ is( $messages->[0]->type, 'error' ); >+ is( $messages->[0]->message, 'overdues' ); >+ >+ $schema->storage->txn_rollback; >+ }; >+ > subtest "'no_short_circuit' tests" => sub { > > plan tests => 9; >-- >2.39.5
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 41960
:
194251
|
194252
| 194253