Bugzilla – Attachment 88404 Details for
Bug 22749
Koha::Item->hidden_in_opac should consider hidelostitems syspref
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22749: Regression tests for Koha::Item->hidden_in_opac
Bug-22749-Regression-tests-for-KohaItem-hiddeninop.patch (text/plain), 2.13 KB, created by
Josef Moravec
on 2019-04-23 08:13:58 UTC
(
hide
)
Description:
Bug 22749: Regression tests for Koha::Item->hidden_in_opac
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-04-23 08:13:58 UTC
Size:
2.13 KB
patch
obsolete
>From ba9762181715c191f1b95dde3496273976f8f56c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 22 Apr 2019 11:54:21 -0300 >Subject: [PATCH] Bug 22749: Regression tests for Koha::Item->hidden_in_opac > >This patch introduces regression tests for Koha::Item->hidden_in_opac to >verify it is not considering the hidelostitems syspref when determining >if an item should be hidden (per policy) in the OPAC. > >To test: >- Apply this patch >- Run: > $ kshell > k$ prove t/db_dependent/Koha/Item.t >=> FAIL: Tests fail! > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > t/db_dependent/Koha/Item.t | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 0c8281b49d..f20c2e7c33 100644 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -32,21 +32,32 @@ my $builder = t::lib::TestBuilder->new; > > subtest 'hidden_in_opac() tests' => sub { > >- plan tests => 3; >+ plan tests => 4; > > $schema->storage->txn_begin; > >- my $item = $builder->build_sample_item; >+ my $item = $builder->build_sample_item({ itemlost => 2 }); > my $rules = {}; > >+ # disable hidelostitems as it interteres with OpachiddenItems for the calculation >+ t::lib::Mocks::mock_preference( 'hidelostitems', 0 ); >+ > ok( !$item->hidden_in_opac, 'No rules passed, shouldn\'t hide' ); > ok( !$item->hidden_in_opac({ rules => $rules }), 'Empty rules passed, shouldn\'t hide' ); > >+ # enable hidelostitems to verify correct behaviour >+ t::lib::Mocks::mock_preference( 'hidelostitems', 1 ); >+ ok( $item->hidden_in_opac, 'Even with no rules, item should hide because of hidelostitems syspref' ); >+ >+ # disable hidelostitems >+ t::lib::Mocks::mock_preference( 'hidelostitems', 0 ); > my $withdrawn = $item->withdrawn + 1; # make sure this attribute doesn't match > > $rules = { withdrawn => [$withdrawn], itype => [ $item->itype ] }; > > ok( $item->hidden_in_opac({ rules => $rules }), 'Rule matching itype passed, should hide' ); > >+ >+ > $schema->storage->txn_rollback; > }; >-- >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 22749
:
88384
|
88385
|
88387
|
88388
|
88389
| 88404 |
88405