Bugzilla – Attachment 90612 Details for
Bug 9834
Reverting a waiting hold should lead to the former hold type (item or biblio level)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9834: Add tests
Bug-9834-Add-tests.patch (text/plain), 3.12 KB, created by
Nick Clemens (kidclamp)
on 2019-06-14 17:49:44 UTC
(
hide
)
Description:
Bug 9834: Add tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-06-14 17:49:44 UTC
Size:
3.12 KB
patch
obsolete
>From c1656840cbb0b732724afc0ac199e43ab59d5f08 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 6 Jun 2019 14:49:43 -0500 >Subject: [PATCH] Bug 9834: Add tests > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/Reserves.t | 62 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 61 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index e78f74014e..624335196a 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 60; >+use Test::More tests => 61; > use Test::MockModule; > use Test::Warn; > >@@ -739,6 +739,66 @@ subtest 'ChargeReserveFee tests' => sub { > is( $line->branchcode, $library->id , "Library id is picked from userenv and stored correctly" ); > }; > >+subtest 'reserves.item_level_hold' => sub { >+ plan tests => 2; >+ >+ my $item = $builder->build_sample_item; >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { branchcode => $item->homebranch } >+ } >+ ); >+ >+ subtest 'item level hold' => sub { >+ plan tests => 2; >+ my $reserve_id = >+ AddReserve( $item->homebranch, $patron->borrowernumber, >+ $item->biblionumber, undef, 1, undef, undef, '', '', >+ $item->itemnumber ); >+ >+ my $hold = Koha::Holds->find($reserve_id); >+ is( $hold->item_level_hold, 1, 'item_level_hold should be set when AddReserve is called with a specific item' ); >+ >+ # Mark it waiting >+ ModReserveAffect( $item->itemnumber, $patron->borrowernumber, 1 ); >+ >+ # Revert the waiting status >+ C4::Reserves::RevertWaitingStatus( >+ { itemnumber => $item->itemnumber } ); >+ >+ $hold = Koha::Holds->find($reserve_id); >+ >+ is( $hold->itemnumber, $item->itemnumber, 'Itemnumber should not be removed when the waiting status is revert' ); >+ >+ $hold->delete; # cleanup >+ }; >+ >+ subtest 'biblio level hold' => sub { >+ plan tests => 3; >+ my $reserve_id = AddReserve( $item->homebranch, $patron->borrowernumber, >+ $item->biblionumber, undef, 1 ); >+ >+ my $hold = Koha::Holds->find($reserve_id); >+ is( $hold->item_level_hold, 0, 'item_level_hold should not be set when AddReserve is called without a specific item' ); >+ >+ # Mark it waiting >+ ModReserveAffect( $item->itemnumber, $patron->borrowernumber, 1 ); >+ >+ $hold = Koha::Holds->find($reserve_id); >+ is( $hold->itemnumber, $item->itemnumber, 'Itemnumber should be set on hold confirmation' ); >+ >+ # Revert the waiting status >+ C4::Reserves::RevertWaitingStatus( { itemnumber => $item->itemnumber } ); >+ >+ $hold = Koha::Holds->find($reserve_id); >+ is( $hold->itemnumber, undef, 'Itemnumber should be removed when the waiting status is revert' ); >+ >+ $hold->delete; >+ }; >+ >+}; >+ > sub count_hold_print_messages { > my $message_count = $dbh->selectall_arrayref(q{ > SELECT COUNT(*) >-- >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 9834
:
90397
|
90398
|
90399
|
90436
|
90437
|
90438
|
90611
| 90612 |
90613
|
90677