Bugzilla – Attachment 163728 Details for
Bug 34972
Canceling a waiting hold from the holds over tab can make the next hold unfillable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34972: Add unit tests for GetOtherReserves
Bug-34972-Add-unit-tests-for-GetOtherReserves.patch (text/plain), 3.40 KB, created by
Andrew Fuerste-Henry
on 2024-03-22 17:41:07 UTC
(
hide
)
Description:
Bug 34972: Add unit tests for GetOtherReserves
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2024-03-22 17:41:07 UTC
Size:
3.40 KB
patch
obsolete
>From 83987d4ea6a95bedd09f8b9f77cd92419114a5ab Mon Sep 17 00:00:00 2001 >From: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Date: Mon, 8 Jan 2024 16:19:59 -0500 >Subject: [PATCH] Bug 34972: Add unit tests for GetOtherReserves > >To test: >1. Apply this patch only >2. Prove -v t/db_dependent/Circulation.t >--> Tests fail >--> Note verbose output for Tests for GetOtherReserves: > ok 3 - GetOtherReserves should not set found status > not ok 4 - GetOtherReserves should not set itemnumber on biblio-level hold >--> The itemnumber is set on a biblio-level hold, but the found status is not set! >3. Apply the other patch >4. Prove -v t/db_dependent/Circulation.t >--> Tests pass > >Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org> >--- > t/db_dependent/Circulation.t | 69 +++++++++++++++++++++++++++++++++++- > 1 file changed, 68 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 5e88a29a00a..eb8ab050a74 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 70; >+use Test::More tests => 71; > use Test::Exception; > use Test::MockModule; > use Test::Deep qw( cmp_deeply ); >@@ -6368,6 +6368,73 @@ subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { > > }; > >+subtest 'Tests for GetOtherReserves' => sub { >+ plan tests => 4; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron_1 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ } >+ ); >+ my $patron_2 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ } >+ ); >+ >+ # GetOtherReserves uses the ItemType object to check not-for-loan value >+ my $itype = $builder->build_object( >+ { >+ class => 'Koha::ItemTypes', >+ value => { >+ notforloan => 0, >+ } >+ } >+ ); >+ >+ my $item = $builder->build_object( >+ { >+ class => 'Koha::Items', >+ value => { >+ itype => $itype->itemtype, >+ homebranch => $library->branchcode, >+ } >+ } >+ ); >+ >+ t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } ); >+ >+ my $reserve_1_id = AddReserve( >+ { >+ branchcode => $item->homebranch, >+ borrowernumber => $patron_1->borrowernumber, >+ biblionumber => $item->biblionumber, >+ } >+ ); >+ >+ my $reserve_2_id = AddReserve( >+ { >+ branchcode => $item->homebranch, >+ borrowernumber => $patron_2->borrowernumber, >+ biblionumber => $item->biblionumber, >+ } >+ ); >+ >+ my $messages; >+ my $nextreservinfo; >+ ( $messages, $nextreservinfo ) = GetOtherReserves( $item->itemnumber ); >+ >+ my $reserve_1 = Koha::Holds->search( { reserve_id => $reserve_1_id } )->next; >+ >+ is( >+ $nextreservinfo->{reserve_id}, $reserve_1->reserve_id, >+ 'GetOtherReserves should return the next reserve in line' >+ ); >+ is( $reserve_1->priority, 1, 'Next reserve in line should be priority 1' ); >+ ok( !$reserve_1->found, 'GetOtherReserves should not set found status' ); >+ ok( !$reserve_1->itemnumber, 'GetOtherReserves should not set itemnumber on a biblio-level hold' ); >+}; > > $schema->storage->txn_rollback; > C4::Context->clear_syspref_cache(); >-- >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 34972
:
160775
|
160776
|
163471
|
163472
|
163473
|
163728
|
163729
|
163730
|
164392
|
164393
|
166024
|
166028
|
166029
|
166100
|
166101
|
166102
|
166103