Bugzilla – Attachment 144436 Details for
Bug 7376
Transfer limits should be checked at check-in
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7376: Unit test
Bug-7376-Unit-test.patch (text/plain), 2.85 KB, created by
Julian Maurice
on 2022-12-06 10:16:20 UTC
(
hide
)
Description:
Bug 7376: Unit test
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2022-12-06 10:16:20 UTC
Size:
2.85 KB
patch
obsolete
>From 8b8cbc2962153e933e80c174a019a564b8520722 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Tue, 19 Jan 2021 20:20:11 +0100 >Subject: [PATCH] Bug 7376: Unit test > >Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> >--- > t/db_dependent/Circulation.t | 42 +++++++++++++++++++++++++++++++++++- > 1 file changed, 41 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 0ba8d69742..94a7bff365 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 64; >+use Test::More tests => 65; > use Test::Exception; > use Test::MockModule; > use Test::Deep qw( cmp_deeply ); >@@ -2211,6 +2211,46 @@ subtest 'AddIssue & illrequests.due_date' => sub { > is( $issue->date_due, $expected_date_due, 'Custom illrequest date due has been set for this issue'); > }; > >+subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { >+ plan tests => 6; >+ >+ my $homebranch = $builder->build( { source => 'Branch' } ); >+ my $otherbranch = $builder->build( { source => 'Branch' } ); >+ my $patron = $builder->build( { source => 'Borrower', value => { categorycode => $patron_category->{categorycode} } } ); >+ >+ my $item = $builder->build_sample_item( >+ { >+ homebranch => $homebranch->{branchcode}, >+ holdingbranch => $homebranch->{branchcode}, >+ } >+ ); >+ >+ t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' ); >+ set_userenv($homebranch); >+ my $issue = AddIssue( $patron, $item->barcode ); >+ my ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $otherbranch); >+ is ( 1 , $allowed , 'with AllowReturnToBranch = anywhere and no limits return to other is allowed'); >+ is ( undef , $message , 'without limits provides no message'); >+ >+ t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '1' ); >+ t::lib::Mocks::mock_preference( 'BranchTransferLimitsType', 'itemtype' ); >+ >+ # set limit >+ my $limit = Koha::Item::Transfer::Limit->new({ >+ toBranch => $otherbranch->{branchcode}, >+ fromBranch => $item->homebranch, >+ itemtype => $item->effective_itemtype, >+ })->store(); >+ >+ ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $otherbranch); >+ is ( 0 , $allowed , 'With transfer limits cannot return to otherbranch'); >+ is ( $homebranch->{branchcode} , $message , 'With transfer limits asks return to homebranch'); >+ >+ ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $homebranch); >+ is ( 1 , $allowed , 'With transfer limits can return to homebranch'); >+ is ( undef , $message , 'With transfer limits and homebranch provides no message'); >+}; >+ > subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { > plan tests => 8; > >-- >2.30.2
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 7376
:
6954
|
21715
|
21805
|
22016
|
22017
|
22323
|
22357
|
22696
|
23168
|
76559
|
76866
|
76876
|
92740
|
92774
|
93190
|
93191
|
93192
|
93193
|
93194
|
93195
|
93196
|
107077
|
107078
|
107079
|
115369
|
115370
|
116493
|
116494
|
116927
|
116928
|
116937
|
116938
|
120897
|
120898
|
120899
|
120900
|
120901
|
120902
|
120903
|
144435
| 144436 |
144437
|
144438
|
144439
|
144440
|
144441