Bugzilla – Attachment 161394 Details for
Bug 32565
Holds placed when all libraries are closed do not get added to holds queue if HoldsQueueSkipClosed and RealTimeHoldsQueue are enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32565: Unit tests
Bug-32565-Unit-tests.patch (text/plain), 3.57 KB, created by
Nick Clemens (kidclamp)
on 2024-01-25 12:32:28 UTC
(
hide
)
Description:
Bug 32565: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-01-25 12:32:28 UTC
Size:
3.57 KB
patch
obsolete
>From 0a221c638d0014ececc668b8d0baebfb5110e670 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 25 Jan 2024 12:31:46 +0000 >Subject: [PATCH] Bug 32565: Unit tests > >--- > t/db_dependent/HoldsQueue.t | 80 ++++++++++++++++++++++++++++++++++++- > 1 file changed, 79 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t >index ebdf7f170f3..19d7768e8ae 100755 >--- a/t/db_dependent/HoldsQueue.t >+++ b/t/db_dependent/HoldsQueue.t >@@ -8,7 +8,7 @@ > > use Modern::Perl; > >-use Test::More tests => 61; >+use Test::More tests => 62; > use Data::Dumper; > > use C4::Calendar qw( new insert_single_holiday ); >@@ -2091,3 +2091,81 @@ subtest "GetItemsAvailableToFillHoldsRequestsForBib" => sub { > is_deeply( [$items->[0]->{itemnumber},$items->[1]->{itemnumber}],[$item_2->itemnumber,$item_3->itemnumber],"Correct two items retrieved"); > > }; >+ >+subtest "Test unallocated option" => sub { >+ >+ plan tests => 6; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object( >+ { >+ class => "Koha::Patrons", >+ } >+ ); >+ my $patron_2 = $builder->build_object( >+ { >+ class => "Koha::Patrons", >+ } >+ ); >+ >+ my $item1 = $builder->build_sample_item( {} )->store(); >+ >+ my $item2 = $builder->build_sample_item( {} )->store(); >+ >+ my $reserve_id = AddReserve( >+ { >+ branchcode => $patron->branchcode, >+ borrowernumber => $patron->borrowernumber, >+ biblionumber => $item1->biblionumber, >+ priority => 1, >+ } >+ ); >+ >+ C4::HoldsQueue::CreateQueue(); >+ >+ my $queue_rs = $schema->resultset('TmpHoldsqueue')->search( { biblionumber => $item1->biblionumber } ); >+ my $hold = $queue_rs->next; >+ is( >+ $hold->itemnumber->itemnumber, >+ $item1->itemnumber, >+ "Picked the item" >+ ); >+ >+ my $timestamp = $hold->timestamp; >+ >+ sleep 2; >+ C4::HoldsQueue::CreateQueue(); >+ $queue_rs = $schema->resultset('TmpHoldsqueue')->search( { biblionumber => $item1->biblionumber } ); >+ $hold = $queue_rs->next; >+ isnt( $hold->timestamp, $timestamp, "Hold was reallocated when queue fully rebuilt" ); >+ $timestamp = $hold->timestamp; >+ >+ C4::HoldsQueue::CreateQueue( { unallocated => 1 } ); >+ $queue_rs = $schema->resultset('TmpHoldsqueue')->search( { biblionumber => $item1->biblionumber } ); >+ $hold = $queue_rs->next; >+ is( $hold->timestamp, $timestamp, "Previously allocated hold not updated when unallocated passed" ); >+ >+ my $reserve_id_2 = AddReserve( >+ { >+ branchcode => $patron_2->branchcode, >+ borrowernumber => $patron_2->borrowernumber, >+ biblionumber => $item2->biblionumber, >+ priority => 1, >+ } >+ ); >+ $queue_rs = $schema->resultset('TmpHoldsqueue')->search( { biblionumber => $item2->biblionumber } ); >+ $hold = $queue_rs->next; >+ ok( !$hold, "New hold is not allocated to queue before run" ); >+ C4::HoldsQueue::CreateQueue( { unallocated => 1 } ); >+ $queue_rs = $schema->resultset('TmpHoldsqueue')->search( { biblionumber => $item2->biblionumber } ); >+ $hold = $queue_rs->next; >+ ok( $hold, "New hold is allocated to queue when run for unallocated holds" ); >+ >+ $queue_rs = $schema->resultset('TmpHoldsqueue')->search( { biblionumber => $item1->biblionumber } ); >+ $hold = $queue_rs->next; >+ is( >+ $hold->timestamp, $timestamp, >+ "Previously allocated hold not updated when unallocated passed and others are allocated" >+ ); >+}; >-- >2.30.2
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 32565
:
147659
|
161231
|
161232
|
161393
|
161394
|
161679
|
161680
|
162269
|
162297
|
164272
|
164273
|
164274
|
165166
|
165167
|
165168
|
165169
|
165800
|
165801
|
165802
|
165803