Bugzilla – Attachment 117464 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: (QA follow-up) Fix tests
Bug-24359-QA-follow-up-Fix-tests.patch (text/plain), 3.35 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-03-01 18:47:36 UTC
(
hide
)
Description:
Bug 24359: (QA follow-up) Fix tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-03-01 18:47:36 UTC
Size:
3.35 KB
patch
obsolete
>From 0afee1e78391ca4aa83b5f74589231408adf2734 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 1 Mar 2021 15:41:21 -0300 >Subject: [PATCH] Bug 24359: (QA follow-up) Fix tests > >This patch fixes a rebase issue, and also makes sure the tests do not >rely on any prior data. The query on tmp_holdsqueue is done against the >actual reserve_id so no need to delete all the data from the >tmp_holdsqueue and hold_fill_targets table. > >I also noticed the previous subtest wasn't run inside a transaction even >if the code was designed to not depend on prior data as well. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/HoldsQueue.t >=> SUCCESS: Tests pass! >3. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/HoldsQueue.t | 27 ++++++++++++++++++++------- > 1 file changed, 20 insertions(+), 7 deletions(-) > >diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t >index 20936fb5d44..358555e94b9 100755 >--- a/t/db_dependent/HoldsQueue.t >+++ b/t/db_dependent/HoldsQueue.t >@@ -8,7 +8,7 @@ > > use Modern::Perl; > >-use Test::More tests => 56; >+use Test::More tests => 57; > use Data::Dumper; > > use C4::Calendar; >@@ -1524,8 +1524,11 @@ sub test_queue { > } > > subtest "Test _checkHoldPolicy" => sub { >+ > plan tests => 25; > >+ $schema->storage->txn_begin; >+ > my $library1 = $builder->build_object( { class => 'Koha::Libraries' } ); > my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); > my $library_nongroup = $builder->build_object( { class => 'Koha::Libraries' } ); >@@ -1652,6 +1655,8 @@ subtest "Test _checkHoldPolicy" => sub { > $item->{borrowerbranch} = $library2->id; > is( C4::HoldsQueue::_checkHoldPolicy( $item, $request ), 1, "_checkHoldPolicy returns true if library is part of hold group with hfp = holdgroup" ); > $item->{borrowerbranch} = $library1->id; >+ >+ $schema->storage->txn_rollback; > }; > > sub dump_records { >@@ -1660,13 +1665,11 @@ sub dump_records { > } > > 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( >@@ -1705,8 +1708,18 @@ subtest 'Remove holds on check-in match' => sub { > > C4::HoldsQueue::CreateQueue(); > >- my $sth = $dbh->prepare("SELECT count(*) FROM tmp_holdsqueue"); >- $sth->execute(); >+ my $sth = $dbh->prepare(q{ >+ SELECT COUNT(*) >+ FROM tmp_holdsqueue q >+ INNER JOIN hold_fill_targets t >+ ON q.borrowernumber = t.borrowernumber >+ AND q.biblionumber = t.biblionumber >+ AND q.itemnumber = t.itemnumber >+ AND q.item_level_request = t.item_level_request >+ AND q.holdingbranch = t.source_branchcode >+ WHERE t.reserve_id = ? >+ }); >+ $sth->execute($hold->reserve_id); > my ($count_1) = $sth->fetchrow_array; > > is( $count_1, 1, "Holds queue has one element" ); >@@ -1716,7 +1729,7 @@ subtest 'Remove holds on check-in match' => sub { > ModReserveAffect( $item->itemnumber, $hold->borrowernumber, 0, > $hold->reserve_id ); > >- $sth->execute(); >+ $sth->execute($hold->reserve_id); > my ($count_2) = $sth->fetchrow_array; > > is( $count_2, 0, >-- >2.30.1
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