Bugzilla – Attachment 149763 Details for
Bug 32702
Item statuses that block holds should be checked in CanItemBeReserved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32702: Unit tests
Bug-32702-Unit-tests.patch (text/plain), 2.39 KB, created by
Nick Clemens (kidclamp)
on 2023-04-17 17:10:09 UTC
(
hide
)
Description:
Bug 32702: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-04-17 17:10:09 UTC
Size:
2.39 KB
patch
obsolete
>From a096a3a58f7af664b8532207db70af7116ec141e Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 17 Apr 2023 17:08:35 +0000 >Subject: [PATCH] Bug 32702: Unit tests > >--- > t/db_dependent/Holds.t | 35 ++++++++++++++++++++++++++++++++++- > 1 file changed, 34 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index c5c79b1d76..47eb710236 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -421,7 +421,7 @@ is( > ); > > subtest 'CanItemBeReserved' => sub { >- plan tests => 2; >+ plan tests => 3; > > my $itemtype_can = $builder->build({source => "Itemtype"})->{itemtype}; > my $itemtype_cant = $builder->build({source => "Itemtype"})->{itemtype}; >@@ -630,6 +630,39 @@ subtest 'CanItemBeReserved' => sub { > "This patron has already placed reservesallowed holds, tooManyReserves should be raised" > ); > }; >+ >+ subtest 'item status tests' => sub { >+ plan tests => 6; >+ >+ t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); >+ my $item = $builder->build_sample_item(); >+ my $biblioitem = $item->biblio->biblioitem; >+ $biblioitem->itemtype(undef)->store(); >+ $item->update({ itype => undef }); >+ is( CanItemBeReserved( $patrons[0], $item)->{status}, 'missing_itemtype', "Item with no itemtype cannot be reserved" ); >+ >+ my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes', value => { notforloan => 1 } }); >+ $item->itype( $itemtype->id )->store(); >+ >+ is( CanItemBeReserved( $patrons[0], $item)->{status}, 'notforloan', "Item with no notforloan itemtype cannot be reserved" ); >+ >+ $itemtype->notforloan(undef)->store(); >+ $item->notforloan(1)->store(); >+ >+ is( CanItemBeReserved( $patrons[0], $item)->{status}, 'notforloan', "Item with no notforloan status cannot be reserved" ); >+ >+ $item->notforloan(-1)->store(); >+ >+ is( CanItemBeReserved( $patrons[0], $item)->{status}, 'OK', "Item with negative notforloan status can be reserved" ); >+ >+ $item->notforloan(0)->store(); >+ >+ is( CanItemBeReserved( $patrons[0], $item)->{status}, 'OK', "Item with no notforloan status can be reserved" ); >+ >+ $item->withdrawn(1)->store(); >+ >+ is( CanItemBeReserved( $patrons[0], $item)->{status}, 'withdrawn', "Item with withdrawn status cannot be reserved" ); >+ }; > }; > > >-- >2.30.2
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 32702
:
145590
|
149762
|
149763
|
157133
|
157134
|
161725
|
161726
|
170156
|
170157
|
170158