Bugzilla – Attachment 91941 Details for
Bug 14549
Hold not removed when item is checked out to patron who is not next in priority list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14549: Unit tests
Bug-14549-Unit-tests.patch (text/plain), 2.73 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-08-02 19:44:21 UTC
(
hide
)
Description:
Bug 14549: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-08-02 19:44:21 UTC
Size:
2.73 KB
patch
obsolete
>From 988e202944e202c5016e453660d2f3d0460546a7 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 28 Jun 2019 12:36:16 +0000 >Subject: [PATCH] Bug 14549: Unit tests > >To test: >1 - Apply just this patch >2 - prove -v t/db_dependent/Reserves.t >3 - Failure >4 - Apply second patch >5 - prove -v t/db_dependent/Reserves.t >6 - Success! > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Reserves.t | 30 +++++++++++++++++++++++++++++- > 1 file changed, 29 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index cdc5f06633..33aa3d9f76 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 61; >+use Test::More tests => 62; > use Test::MockModule; > use Test::Warn; > >@@ -807,6 +807,34 @@ subtest 'reserves.item_level_hold' => sub { > > }; > >+subtest 'MoveReserve additional test' => sub { >+ >+ plan tests => 4; >+ >+ # Create the items and patrons we need >+ my $biblio = $builder->build_sample_biblio(); >+ my $itype = $builder->build_object({ class => "Koha::ItemTypes", value => { notforloan => 0 } }); >+ my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber,notforloan => 0, itype => $itype->itemtype }); >+ my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber, notforloan => 0, itype => $itype->itemtype }); >+ my $patron_1 = $builder->build_object({ class => "Koha::Patrons" }); >+ my $patron_2 = $builder->build_object({ class => "Koha::Patrons" }); >+ >+ # Place a hold on the title for both patrons >+ my $reserve_1 = AddReserve( $item_1->homebranch, $patron_1->borrowernumber, $biblio->biblionumber, undef, 1 ); >+ my $reserve_2 = AddReserve( $item_2->homebranch, $patron_2->borrowernumber, $biblio->biblionumber, undef, 1 ); >+ is($patron_1->holds->next()->reserve_id, $reserve_1, "The 1st patron has a hold"); >+ is($patron_2->holds->next()->reserve_id, $reserve_2, "The 2nd patron has a hold"); >+ >+ # Fake the holds queue >+ $dbh->do(q{INSERT INTO hold_fill_targets VALUES (?, ?, ?, ?, ?)},undef,($patron_1->borrowernumber,$biblio->biblionumber,$item_1->itemnumber,$item_1->homebranch,0)); >+ >+ # The 2nd hold should be filed even if the item is preselected for the first hold >+ MoveReserve($item_1->itemnumber,$patron_2->borrowernumber); >+ is($patron_2->holds->count, 0, "The 2nd patrons no longer has a hold"); >+ is($patron_2->old_holds->next()->reserve_id, $reserve_2, "The 2nd patrons hold was filled and moved to old holds"); >+ >+}; >+ > sub count_hold_print_messages { > my $message_count = $dbh->selectall_arrayref(q{ > SELECT COUNT(*) >-- >2.22.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 14549
:
41048
|
91067
|
91068
|
91069
|
91776
|
91777
|
91778
| 91941 |
91942
|
91943