Bugzilla – Attachment 171249 Details for
Bug 37651
biblio->current_holds and item->current_holds do not respect ConfirmFutureHolds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37651: Unit tests
Bug-37651-Unit-tests.patch (text/plain), 3.08 KB, created by
Marcel de Rooy
on 2024-09-10 12:20:45 UTC
(
hide
)
Description:
Bug 37651: Unit tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-09-10 12:20:45 UTC
Size:
3.08 KB
patch
obsolete
>From 0f2d99debc95c9b83489ab406af5182c7ccc6ed1 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 19 Aug 2024 13:09:40 +0000 >Subject: [PATCH] Bug 37651: Unit tests >Content-Type: text/plain; charset=utf-8 > >Test plan: >Run t/db_dependent/Holds.t (Without previous patches, it would fail.) >Run t/db_dependent/Koha/Biblios.t >--- > t/db_dependent/Holds.t | 25 ++++++++++++++++++++++++- > t/db_dependent/Koha/Biblios.t | 10 +++++++--- > 2 files changed, 31 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 4c78b4c480..b2bdf4c8af 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -7,7 +7,7 @@ use t::lib::TestBuilder; > > use C4::Context; > >-use Test::More tests => 74; >+use Test::More tests => 75; > use Test::Exception; > > use MARC::Record; >@@ -1887,3 +1887,26 @@ subtest 'EmailPatronWhenHoldIsPlaced tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'current_holds with future holds' => sub { >+ plan tests => 2; >+ $schema->storage->txn_begin; >+ >+ t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 ); >+ my $item = $builder->build_sample_item; >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $hold_id = AddReserve( >+ { >+ reservation_date => dt_from_string()->add( days => 1 ), >+ branchcode => $item->homebranch, >+ borrowernumber => $patron->id, >+ biblionumber => $item->biblionumber, >+ itemnumber => $item->itemnumber, >+ } >+ ); >+ is( $item->biblio->current_holds->count, 1, 'Future hold was counted' ); >+ t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 ); >+ is( $item->biblio->current_holds->count, 0, 'No future hold was counted when ConfirmFutureHolds is zero' ); >+ >+ $schema->storage->txn_rollback; >+}; >diff --git a/t/db_dependent/Koha/Biblios.t b/t/db_dependent/Koha/Biblios.t >index fde249ffe5..624e5b7328 100755 >--- a/t/db_dependent/Koha/Biblios.t >+++ b/t/db_dependent/Koha/Biblios.t >@@ -67,7 +67,7 @@ subtest 'store' => sub { > }; > > subtest 'holds + current_holds' => sub { >- plan tests => 5; >+ plan tests => 6; > C4::Reserves::AddReserve( > { > branchcode => $patron->branchcode, >@@ -90,12 +90,16 @@ subtest 'holds + current_holds' => sub { > reservation_date => dt_from_string->add( days => 2 ), > } > ); >+ t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 ); > $holds = $biblio->holds; > is( $holds->count, 1, '->holds should return future holds' ); > $holds = $biblio->current_holds; >- is( $holds->count, 0, '->current_holds should not return future holds' ); >+ is( $holds->count, 0, '->current_holds without lookahead should not return future holds' ); >+ t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 ); >+ $holds = $biblio->current_holds; >+ is( $holds->count, 1, '->current_holds with lookahead returns future holds' ); > $holds->delete; >- >+ t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 ); > }; > > subtest 'waiting_or_in_transit' => sub { >-- >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 37651
:
171247
|
171248
|
171249
|
171250