Bugzilla – Attachment 112641 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.80 KB, created by
Agustín Moyano
on 2020-10-28 14:05:09 UTC
(
hide
)
Description:
Bug 24359: Add test
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2020-10-28 14:05:09 UTC
Size:
2.80 KB
patch
obsolete
>From 1d7184ad1290bddd34b12dda17ad74cb8e5b29d0 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 > >--- > t/db_dependent/HoldsQueue.t | 69 ++++++++++++++++++++++++++++++++++++- > 1 file changed, 68 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t >index 06047c647f..04ef9fd73d 100755 >--- a/t/db_dependent/HoldsQueue.t >+++ b/t/db_dependent/HoldsQueue.t >@@ -8,12 +8,13 @@ > > use Modern::Perl; > >-use Test::More tests => 55; >+use Test::More tests => 56; > use Data::Dumper; > > use C4::Calendar; > use C4::Context; > use C4::Members; >+use C4::Circulation; > use Koha::Database; > use Koha::DateUtils; > use Koha::Items; >@@ -1523,3 +1524,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.25.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 24359
:
112641
|
112642
|
114405
|
114406
|
117462
|
117463
|
117464
|
117465
|
117466
|
117467