Bugzilla – Attachment 120900 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: (follow-up) Make extended tests mock the actual desired behaviour
Bug-7376-follow-up-Make-extended-tests-mock-the-ac.patch (text/plain), 3.80 KB, created by
Victor Grousset/tuxayo
on 2021-05-12 19:44:20 UTC
(
hide
)
Description:
Bug 7376: (follow-up) Make extended tests mock the actual desired behaviour
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2021-05-12 19:44:20 UTC
Size:
3.80 KB
patch
obsolete
>From 72076132719ebd04cb57adf0f13a76033c212f03 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Wed, 17 Feb 2021 02:57:57 +0100 >Subject: [PATCH] Bug 7376: (follow-up) Make extended tests mock the actual > desired behaviour > >--- > t/db_dependent/Circulation.t | 27 ++++++++++++++++++++++----- > 1 file changed, 22 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 407648cb78..bb6cccecb6 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -1926,7 +1926,7 @@ subtest 'AddIssue & AllowReturnToBranch' => sub { > > > subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { >- plan tests => 31; >+ plan tests => 33; > > t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '1' ); > >@@ -2020,7 +2020,24 @@ subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { > # NOTE: This is the ONLY change that bug 7376 introduces currently. > t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' ); > ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch); >- is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere'); >+ is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to holding (homebranch forbidden) from returnbranch'); >+ >+ my $limit_2 = Koha::Item::Transfer::Limit->new({ >+ toBranch => $holdingbranch->{branchcode}, >+ fromBranch => $returnbranch->{branchcode}, >+ itemtype => $item->effective_itemtype, >+ })->store(); >+ >+ diag("Attempt return at returnbranch ('Anywhere' + Return -> Home and Return -> Holding limit)"); >+ # NOTE: Should we prevent return here.. we cannot transfer from 'returnbranch' >+ # to 'homebranch' (But we can transfer back to 'holdingbranch'). >+ # NOTE: This is the ONLY change that bug 7376 introduces currently. >+ t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' ); >+ ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch); >+ is ( 0 , $allowed , 'Prevent return where item can\'t be transferred to both homebranch and holding from returnbranch'); >+ is ( $homebranch->{branchcode} , $message , 'Redirect to homebranch'); >+ >+ $limit_2->delete()->store()->discard_changes; > > # Set limit ( Return -> Holding denied) > $limit->set( >@@ -2053,7 +2070,7 @@ subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { > # to 'holdingbranch' (But we can transfer back to 'homebranch'). > t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' ); > ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch); >- is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere'); >+ is ( 1 , $allowed , 'Allow return where returnbranch can be transferred to homebranch (holdingbranch forbidden) from returnbranch'); > > # Set limit ( Holding -> Home denied) > $limit->set( >@@ -2082,11 +2099,11 @@ subtest 'CanBookBeReturned + UseBranchTransfertLimits' => sub { > is ( $homebranch->{branchcode} , $message , 'Redirect to homebranch'); > > diag("Attempt return at returnbranch ('Anywhere' + Holding -> Home limit)"); >- # NOTE: A return here can subsequently be transfered to back to homebranch >+ # NOTE: A return here can subsequently be transferred to back to homebranch > # or holdingbranch. > t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' ); > ($allowed, $message) = C4::Circulation::CanBookBeReturned($item, $returnbranch); >- is ( 1 , $allowed , 'Allow return where returnbranch can be transfered to from anywhere'); >+ is ( 1 , $allowed , 'Allow return where returnbranch can be transferred to from anywhere'); > }; > > subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { >-- >2.31.1
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