Bugzilla – Attachment 82522 Details for
Bug 10589
Override OpacHiddenItems based on Patron Branch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10589: Unit tests of changes
Bug-10589-Unit-tests-of-changes.patch (text/plain), 2.44 KB, created by
Mark Tompsett
on 2018-11-19 18:49:38 UTC
(
hide
)
Description:
Bug 10589: Unit tests of changes
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-11-19 18:49:38 UTC
Size:
2.44 KB
patch
obsolete
>From 1b3675acb42aa88f65c1b151fc8ee470f37679f4 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Mon, 19 Nov 2018 18:27:01 +0000 >Subject: [PATCH] Bug 10589: Unit tests of changes > >The core changes were in C4/Items.pm with >GetHiddenItemnumbers now processing logic against >a patron branch vs. an item's home branch and >does the patron have the local exception category. > >This adds 4 tests to confirm those changes. > >prove -v t/db_dependent/Items.t > >If you apply just this, the tests should fail. >If you apply both patches, the tests should pass. >--- > t/db_dependent/Items.t | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index a7a3a7fbc6..563ec4f383 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -148,7 +148,7 @@ subtest 'ModItem tests' => sub { > > subtest 'GetHiddenItemnumbers tests' => sub { > >- plan tests => 11; >+ plan tests => 15; > > # This sub is controlled by the OpacHiddenItems system preference. > >@@ -198,6 +198,8 @@ subtest 'GetHiddenItemnumbers tests' => sub { > push @items, GetItem( $item2_itemnumber ); > > # Empty OpacHiddenItems >+ t::lib::Mocks::mock_preference('OpacHiddenItemsExceptions', q{}); >+ t::lib::Mocks::mock_preference('OpacHiddenItemsLocalExceptions', q{}); > t::lib::Mocks::mock_preference('OpacHiddenItems',''); > ok( !defined( GetHiddenItemnumbers( { items => \@items } ) ), > "Hidden items list undef if OpacHiddenItems empty"); >@@ -240,6 +242,15 @@ subtest 'GetHiddenItemnumbers tests' => sub { > @hidden = GetHiddenItemnumbers( { items => \@items, borcat => 'S' } ); > ok( scalar @hidden == 0, "Two items not hidden"); > >+ # Override hidden with a local patron category >+ t::lib::Mocks::mock_preference( 'OpacHiddenItemsLocalExceptions', 'PT' ); >+ @hidden = GetHiddenItemnumbers( { items => \@items, borcat => 'PT', patron_branch => $library1->{branchcode} } ); >+ ok( scalar @hidden == 1, "One local item not hidden"); >+ ok( $hidden[0] == $item2_itemnumber, 'Library 2 item still hidden' ); >+ @hidden = GetHiddenItemnumbers( { items => \@items, borcat => 'PT', patron_branch => $library2->{branchcode} } ); >+ ok( scalar @hidden == 1, "One local item not hidden"); >+ ok( $hidden[0] == $item1_itemnumber, 'Library 1 item still hidden' ); >+ > # Valid OpacHiddenItems, empty list > @items = (); > @hidden = GetHiddenItemnumbers( { items => \@items } ); >-- >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 10589
:
19647
|
19708
|
19931
|
19932
|
19933
|
19949
|
19954
|
21063
|
21066
|
21256
|
21620
|
22587
|
22629
|
30796
|
30806
|
82521
| 82522