Bugzilla – Attachment 140389 Details for
Bug 27259
HomeOrHoldingBranch is not used in all places
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27259: Test HomeOrHoldingBranch usage in TooMany()
Bug-27259-Test-HomeOrHoldingBranch-usage-in-TooMan.patch (text/plain), 3.75 KB, created by
Andrii Nugged
on 2022-09-11 12:34:49 UTC
(
hide
)
Description:
Bug 27259: Test HomeOrHoldingBranch usage in TooMany()
Filename:
MIME Type:
Creator:
Andrii Nugged
Created:
2022-09-11 12:34:49 UTC
Size:
3.75 KB
patch
obsolete
>From b529ed754f9317816a748cfb4162778418048ebe Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= <joonas.kylmala@helsinki.fi> >Date: Fri, 18 Dec 2020 12:22:46 +0200 >Subject: [PATCH] Bug 27259: Test HomeOrHoldingBranch usage in TooMany() > >This shows that HomeOrHoldingBranch syspref is incorrectly not used by >TooMany() when it decides which circ rule to use. > >Run "prove t/db_dependent/Circulation/TooMany.t" to notice the tests >now fail. >--- > t/db_dependent/Circulation/TooMany.t | 73 +++++++++++++++++++++++++++- > 1 file changed, 71 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Circulation/TooMany.t b/t/db_dependent/Circulation/TooMany.t >index c8dbd09a7a..c151411e51 100755 >--- a/t/db_dependent/Circulation/TooMany.t >+++ b/t/db_dependent/Circulation/TooMany.t >@@ -15,7 +15,7 @@ > # with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 10; >+use Test::More tests => 11; > use C4::Context; > > use C4::Members; >@@ -52,6 +52,10 @@ my $branch = $builder->build({ > source => 'Branch', > }); > >+my $branch2 = $builder->build({ >+ source => 'Branch', >+}); >+ > my $category = $builder->build({ > source => 'Category', > }); >@@ -583,6 +587,8 @@ subtest 'General vs specific rules limit quantity correctly' => sub { > } > ); > >+ t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch'); >+ > is( > C4::Circulation::TooMany( $patron, $branch_item ), > undef, >@@ -655,7 +661,6 @@ subtest 'General vs specific rules limit quantity correctly' => sub { > 'We are only allowed one for general rule, and have checked out two at this branch' > ); > >- my $branch2 = $builder->build({source => 'Branch',}); > t::lib::Mocks::mock_userenv({ branchcode => $branch2->{branchcode} }); > is_deeply( > C4::Circulation::TooMany( $patron, $item_2 ), >@@ -977,6 +982,70 @@ subtest 'itemtype group tests' => sub { > teardown(); > }; > >+subtest 'HomeOrHoldingBranch is used' => sub { >+ plan tests => 2; >+ >+ t::lib::Mocks::mock_preference( 'CircControl', 'ItemHomeLibrary' ); >+ >+ my $item_1 = $builder->build_sample_item( >+ { >+ homebranch => $branch->{branchcode}, >+ holdingbranch => $branch2->{branchcode}, >+ } >+ ); >+ >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $branch->{branchcode}, >+ categorycode => undef, >+ itemtype => undef, >+ rules => { >+ maxissueqty => 0, >+ } >+ } >+ ); >+ >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $branch2->{branchcode}, >+ categorycode => undef, >+ itemtype => undef, >+ rules => { >+ maxissueqty => 1, >+ } >+ } >+ ); >+ >+ t::lib::Mocks::mock_userenv({ branchcode => $branch2->{branchcode} }); >+ my $issue = C4::Circulation::AddIssue( $patron, $item_1->barcode, dt_from_string() ); >+ >+ t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'homebranch'); >+ >+ is_deeply( >+ C4::Circulation::TooMany( $patron, $item_1 ), >+ { >+ reason => 'TOO_MANY_CHECKOUTS', >+ max_allowed => 0, >+ count => 1, >+ }, >+ 'We are allowed zero issues from the homebranch specifically' >+ ); >+ >+ t::lib::Mocks::mock_preference('HomeOrHoldingBranch', 'holdingbranch'); >+ >+ is_deeply( >+ C4::Circulation::TooMany( $patron, $item_1 ), >+ { >+ reason => 'TOO_MANY_CHECKOUTS', >+ max_allowed => 1, >+ count => 1, >+ }, >+ 'We are allowed one issue from the holdingbranch specifically' >+ ); >+ >+ teardown(); >+}; >+ > $schema->storage->txn_rollback; > > sub teardown { >-- >2.37.3
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 27259
:
114591
|
114592
|
114593
|
133700
|
133701
|
133702
|
140388
|
140389
|
140390
|
140391
|
141021
|
141022
|
141023
|
143013
|
143014
|
143015