Bugzilla – Attachment 151135 Details for
Bug 31557
Add ability for holds queue builder to prioritize either matching a patron's home library to the item's home or holding library
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31557: (QA follow-up) Make tests more robust
Bug-31557-QA-follow-up-Make-tests-more-robust.patch (text/plain), 3.63 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-05-12 14:16:25 UTC
(
hide
)
Description:
Bug 31557: (QA follow-up) Make tests more robust
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-05-12 14:16:25 UTC
Size:
3.63 KB
patch
obsolete
>From e4994e47dd352b888026b259d7356af7bcd8b085 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 12 May 2023 11:11:44 -0300 >Subject: [PATCH] Bug 31557: (QA follow-up) Make tests more robust > >Tests had a few problems: > >- They weren't wrapped in a transaction explicitly >- They called Koha::Biblios->delete! >- They failed if run a couple times > >This patch: > >- Wraps things in a transaction >- Removes not-required things ($target_rs variable not used) >- Preserves the tests logic, but filters the resultset on the > biblionumber instead of deleting all the database which can fail > depending on FK constraints. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/HoldsQueue.t | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > >diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t >index 50a9e61c6c4..a851cf32bed 100755 >--- a/t/db_dependent/HoldsQueue.t >+++ b/t/db_dependent/HoldsQueue.t >@@ -1969,12 +1969,13 @@ subtest "GetHoldsQueueItems" => sub { > }; > > subtest "Test HoldsQueuePrioritizeBranch" => sub { >+ > plan tests => 4; > >- Koha::Biblios->delete(); >+ $schema->storage->txn_begin; >+ > t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 0 ); >- t::lib::Mocks::mock_preference( 'HoldsQueuePrioritizeBranch', 'homebranch' ); >- t::lib::Mocks::mock_preference('UseTransportCostMatrix', 0); >+ t::lib::Mocks::mock_preference( 'UseTransportCostMatrix', 0 ); > > my $branch1 = $builder->build_object( { class => 'Koha::Libraries' } ); > my $branch2 = $builder->build_object( { class => 'Koha::Libraries' } ); >@@ -2013,10 +2014,11 @@ subtest "Test HoldsQueuePrioritizeBranch" => sub { > } > ); > >+ t::lib::Mocks::mock_preference( 'HoldsQueuePrioritizeBranch', 'homebranch' ); >+ > C4::HoldsQueue::CreateQueue(); > >- my $queue_rs = $schema->resultset('TmpHoldsqueue'); >- my $target_rs = $schema->resultset('HoldFillTarget'); >+ my $queue_rs = $schema->resultset('TmpHoldsqueue')->search({ biblionumber => $biblio->biblionumber }); > is( > $queue_rs->next->itemnumber->itemnumber, > $item1->itemnumber, >@@ -2027,21 +2029,18 @@ subtest "Test HoldsQueuePrioritizeBranch" => sub { > > C4::HoldsQueue::CreateQueue(); > >- $queue_rs = $schema->resultset('TmpHoldsqueue'); >- $target_rs = $schema->resultset('HoldFillTarget'); >+ $queue_rs = $schema->resultset('TmpHoldsqueue')->search({ biblionumber => $biblio->biblionumber }); > is( > $queue_rs->next->itemnumber->itemnumber, > $item2->itemnumber, > "Picked the item whose holdingbranch matches the pickup branch" > ); > >- t::lib::Mocks::mock_preference('UseTransportCostMatrix', 1); > t::lib::Mocks::mock_preference( 'HoldsQueuePrioritizeBranch', 'homebranch' ); > > C4::HoldsQueue::CreateQueue(); > >- $queue_rs = $schema->resultset('TmpHoldsqueue'); >- $target_rs = $schema->resultset('HoldFillTarget'); >+ $queue_rs = $schema->resultset('TmpHoldsqueue')->search({ biblionumber => $biblio->biblionumber }); > is( > $queue_rs->next->itemnumber->itemnumber, > $item1->itemnumber, >@@ -2052,11 +2051,12 @@ subtest "Test HoldsQueuePrioritizeBranch" => sub { > > C4::HoldsQueue::CreateQueue(); > >- $queue_rs = $schema->resultset('TmpHoldsqueue'); >- $target_rs = $schema->resultset('HoldFillTarget'); >+ $queue_rs = $schema->resultset('TmpHoldsqueue')->search({ biblionumber => $biblio->biblionumber }); > is( > $queue_rs->next->itemnumber->itemnumber, > $item2->itemnumber, > "Picked the item whose holdingbranch matches the pickup branch" > ); >+ >+ $schema->storage->txn_rollback; > }; >-- >2.34.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 31557
:
142082
|
143136
|
147284
|
147285
| 151135