Bugzilla – Attachment 117465 Details for
Bug 24359
Remove items from Holds Queue when checked in
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24359: Add test
Bug-24359-Add-test.patch (text/plain), 2.89 KB, created by
Kyle M Hall (khall)
on 2021-03-01 22:57:06 UTC
(
hide
)
Description:
Bug 24359: Add test
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-03-01 22:57:06 UTC
Size:
2.89 KB
patch
obsolete
>From 43d18da1b294ac6d6dce192f8085873c045b4408 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Wed, 28 Oct 2020 10:48:09 -0300 >Subject: [PATCH] Bug 24359: Add test > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/HoldsQueue.t | 67 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 67 insertions(+) > >diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t >index 4ffac93358..20936fb5d4 100755 >--- a/t/db_dependent/HoldsQueue.t >+++ b/t/db_dependent/HoldsQueue.t >@@ -14,6 +14,7 @@ use Data::Dumper; > use C4::Calendar; > use C4::Context; > use C4::Members; >+use C4::Circulation; > use Koha::Database; > use Koha::DateUtils; > use Koha::Items; >@@ -1657,3 +1658,69 @@ sub dump_records { > my ($tablename) = @_; > return $dbh->selectall_arrayref("SELECT * from $tablename where borrowernumber = ?", { Slice => {} }, $borrowernumber); > } >+ >+subtest 'Remove holds on check-in match' => sub { >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ $dbh->do('DELETE FROM tmp_holdsqueue'); >+ $dbh->do('DELETE FROM hold_fill_targets'); >+ >+ my $lib = $builder->build_object( { class => 'Koha::Libraries' } ); >+ >+ my $patron1 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { branchcode => $lib->branchcode } >+ } >+ ); >+ my $patron2 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { branchcode => $lib->branchcode } >+ } >+ ); >+ >+ my $item = $builder->build_sample_item( >+ { homebranch => $lib->branchcode, holdingbranch => $lib->branchcode } ); >+ >+ t::lib::Mocks::mock_userenv( { branchcode => $lib->branchcode } ); >+ >+ AddIssue( $patron1->unblessed, $item->barcode, dt_from_string ); >+ >+ my $hold_id = AddReserve( >+ { >+ branchcode => $item->homebranch, >+ borrowernumber => $patron2->borrowernumber, >+ biblionumber => $item->biblionumber, >+ itemnumber => undef, >+ priority => 1 >+ } >+ ); >+ >+ my $hold = Koha::Holds->find($hold_id); >+ >+ AddReturn( $item->barcode, $item->homebranch ); >+ >+ C4::HoldsQueue::CreateQueue(); >+ >+ my $sth = $dbh->prepare("SELECT count(*) FROM tmp_holdsqueue"); >+ $sth->execute(); >+ my ($count_1) = $sth->fetchrow_array; >+ >+ is( $count_1, 1, "Holds queue has one element" ); >+ >+ AddReturn( $item->barcode, $item->homebranch, undef, dt_from_string ); >+ >+ ModReserveAffect( $item->itemnumber, $hold->borrowernumber, 0, >+ $hold->reserve_id ); >+ >+ $sth->execute(); >+ my ($count_2) = $sth->fetchrow_array; >+ >+ is( $count_2, 0, >+ "Holds queue has no elements, even when queue was not rebuilt" ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.24.1 (Apple Git-126)
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 24359
:
112641
|
112642
|
114405
|
114406
|
117462
|
117463
|
117464
| 117465 |
117466
|
117467