Bugzilla – Attachment 75325 Details for
Bug 20724
ReservesNeedReturns syspref breaks "Holds awaiting pickup"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20724: Add tests for ReservesNeedReturns
Bug-20724-Add-tests-for-ReservesNeedReturns.patch (text/plain), 3.60 KB, created by
Victor Grousset/tuxayo
on 2018-05-15 09:06:42 UTC
(
hide
)
Description:
Bug 20724: Add tests for ReservesNeedReturns
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2018-05-15 09:06:42 UTC
Size:
3.60 KB
patch
obsolete
>From 5d0fafe59238b9d0f464b5e3cb1a06828859ccb4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 10 May 2018 11:40:33 -0300 >Subject: [PATCH] Bug 20724: Add tests for ReservesNeedReturns > >Signed-off-by: Victor Grousset <victor.grousset@biblibre.com> >--- > t/db_dependent/Reserves.t | 56 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 55 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 57de1dd..e0bba34 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 56; >+use Test::More tests => 57; > use Test::MockModule; > use Test::Warn; > >@@ -54,6 +54,9 @@ my $builder = t::lib::TestBuilder->new; > > my $frameworkcode = q||; > >+ >+t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); >+ > # Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached > $dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestriction' where tagfield='521' and tagsubfield='a' and frameworkcode=?", undef, $frameworkcode); > my $cache = Koha::Caches->get_instance; >@@ -668,6 +671,57 @@ subtest '_koha_notify_reserve() tests' => sub { > > }; > >+subtest 'ReservesNeedReturns' => sub { >+ plan tests => 4; >+ >+ my $biblioitem = $builder->build_object( { class => 'Koha::Biblioitems' } ); >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes', value => { rentalcharge => 0 } } ); >+ my $item_info = { >+ biblionumber => $biblioitem->biblionumber, >+ biblioitemnumber => $biblioitem->biblioitemnumber, >+ homebranch => $library->branchcode, >+ holdingbranch => $library->branchcode, >+ itype => $itemtype->itemtype, >+ }; >+ my $item = $builder->build_object( { class => 'Koha::Items', value => $item_info } ); >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { branchcode => $library->branchcode, } >+ } >+ ); >+ >+ my $priority = 1; >+ my ( $hold_id, $hold ); >+ >+ t::lib::Mocks::mock_preference('ReservesNeedReturns', 0); # '0' means 'Automatically mark a hold as found and waiting' >+ $hold_id = C4::Reserves::AddReserve( >+ $library->branchcode, $patron->borrowernumber, >+ $item->biblionumber, '', >+ $priority, undef, >+ undef, '', >+ "title for fee", $item->itemnumber, >+ ); >+ $hold = Koha::Holds->find($hold_id); >+ is( $hold->priority, 0, 'If ReservesNeedReturns is 0, priority must have been set to 0' ); >+ is( $hold->found, 'W', 'If ReservesNeedReturns is 0, found must have been set waiting' ); >+ >+ $hold->delete; # cleanup >+ >+ t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); # '0' means "Don't automatically mark a hold as found and waiting" >+ $hold_id = C4::Reserves::AddReserve( >+ $library->branchcode, $patron->borrowernumber, >+ $item->biblionumber, '', >+ $priority, undef, >+ undef, '', >+ "title for fee", $item->itemnumber, >+ ); >+ $hold = Koha::Holds->find($hold_id); >+ is( $hold->priority, $priority, 'If ReservesNeedReturns is 1, priority must not have been set to changed' ); >+ is( $hold->found, undef, 'If ReservesNeedReturns is 1, found must not have been set waiting' ); >+}; >+ > sub count_hold_print_messages { > my $message_count = $dbh->selectall_arrayref(q{ > SELECT COUNT(*) >-- >2.7.4
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 20724
:
75211
|
75219
|
75221
|
75222
|
75223
|
75307
|
75308
|
75309
|
75325
|
75363
|
75364
|
75365
|
75366
|
75367