Bugzilla – Attachment 125946 Details for
Bug 3142
Standardize how OPAC and staff determine requestability
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 3142: Add tests
Bug-3142-Add-tests.patch (text/plain), 2.83 KB, created by
Marcel de Rooy
on 2021-10-08 09:26:16 UTC
(
hide
)
Description:
Bug 3142: Add tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-10-08 09:26:16 UTC
Size:
2.83 KB
patch
obsolete
>From eb69b32532602af0d57e85f3ea96938e5df6834f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 5 Oct 2021 14:17:22 +0200 >Subject: [PATCH] Bug 3142: Add tests >Content-Type: text/plain; charset=utf-8 > >And fix a bug! > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Items.pm | 2 +- > t/db_dependent/Koha/Items.t | 17 ++++++++++++++++- > 2 files changed, 17 insertions(+), 2 deletions(-) > >diff --git a/Koha/Items.pm b/Koha/Items.pm >index 3f27ecbd4b..895123c7be 100644 >--- a/Koha/Items.pm >+++ b/Koha/Items.pm >@@ -65,7 +65,7 @@ sub filter_by_for_hold { > withdrawn => 0, > notforloan => { '<=' => 0 } > , # items with negative or zero notforloan value are holdable >- ( C4::Context->preference('AllowHoldsOnDamagedItems') ? ( damaged => 0 ) : () ), >+ ( ! C4::Context->preference('AllowHoldsOnDamagedItems' ) ? ( damaged => 0 ) : () ), > itype => { -not_in => \@hold_not_allowed_itypes }, > } > ); >diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t >index d743402b1a..d8aed21754 100755 >--- a/t/db_dependent/Koha/Items.t >+++ b/t/db_dependent/Koha/Items.t >@@ -1510,7 +1510,7 @@ subtest 'can_be_transferred' => sub { > }; > > subtest 'filter_by_for_hold' => sub { >- plan tests => 4; >+ plan tests => 8; > > my $biblio = $builder->build_sample_biblio; > is( $biblio->items->filter_by_for_hold->count, 0, 'no item yet' ); >@@ -1521,6 +1521,21 @@ subtest 'filter_by_for_hold' => sub { > $builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => -1 } ); > is( $biblio->items->filter_by_for_hold->count, 2, '2 items for hold' ); > >+ $builder->build_sample_item( { biblionumber => $biblio->biblionumber, itemlost => 0 } ); >+ $builder->build_sample_item( { biblionumber => $biblio->biblionumber, itemlost => 1 } ); >+ is( $biblio->items->filter_by_for_hold->count, 3, '3 items for hold - itemlost' ); >+ >+ $builder->build_sample_item( { biblionumber => $biblio->biblionumber, withdrawn => 0 } ); >+ $builder->build_sample_item( { biblionumber => $biblio->biblionumber, withdrawn => 1 } ); >+ is( $biblio->items->filter_by_for_hold->count, 4, '4 items for hold - withdrawn' ); >+ >+ $builder->build_sample_item( { biblionumber => $biblio->biblionumber, damaged => 0 } ); >+ $builder->build_sample_item( { biblionumber => $biblio->biblionumber, damaged => 1 } ); >+ t::lib::Mocks::mock_preference('AllowHoldsOnDamagedItems', 0); >+ is( $biblio->items->filter_by_for_hold->count, 5, '5 items for hold - not damaged if not AllowHoldsOnDamagedItems' ); >+ t::lib::Mocks::mock_preference('AllowHoldsOnDamagedItems', 1); >+ is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - damaged if AllowHoldsOnDamagedItems' ); >+ > $biblio->delete; > }; > >-- >2.20.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 3142
:
122284
|
122285
|
122286
|
122287
|
122314
|
122315
|
122316
|
122317
|
125727
|
125728
|
125729
|
125730
|
125732
|
125733
|
125734
|
125942
|
125943
|
125944
|
125945
|
125946
|
125947
|
125948
|
125949
|
125950
|
125951
|
125956
|
125967
|
125968
|
125969
|
125970
|
125971
|
125972
|
125973
|
125974
|
125975
|
125976
|
125977