Bugzilla – Attachment 120331 Details for
Bug 28206
Waiting holds should be filled at checkout even if they violate holds policies
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28206: Move tests to a subtest
Bug-28206-Move-tests-to-a-subtest.patch (text/plain), 4.14 KB, created by
Jonathan Druart
on 2021-04-30 09:46:36 UTC
(
hide
)
Description:
Bug 28206: Move tests to a subtest
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-04-30 09:46:36 UTC
Size:
4.14 KB
patch
obsolete
>From 05587d0186226c88182ab9389ed1c80b60599a1d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 30 Apr 2021 11:19:05 +0200 >Subject: [PATCH] Bug 28206: Move tests to a subtest > >--- > t/db_dependent/Holds.t | 75 +++++++++++++++++++++++++++++++----------- > 1 file changed, 56 insertions(+), 19 deletions(-) > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 64419b5fee8..a17a173c95b 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 => 71; >+use Test::More tests => 67; > use MARC::Record; > > use C4::Biblio; >@@ -325,26 +325,63 @@ ok( > is( $hold3->discard_changes->priority, 1, "After ModReserve, the 3rd reserve becomes the first on the waiting list" ); > } > >-Koha::Items->find($itemnumber)->damaged(1)->store; # FIXME The $itemnumber is a bit confusing here >-t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 1 ); >-is( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'OK', "Patron can reserve damaged item with AllowHoldsOnDamagedItems enabled" ); >-ok( defined( ( CheckReserves($itemnumber) )[1] ), "Hold can be trapped for damaged item with AllowHoldsOnDamagedItems enabled" ); >+subtest 'AllowHoldsOnDamagedItems' => sub { >+ plan tests => 5; > >-$hold = Koha::Hold->new( >- { >- borrowernumber => $borrowernumbers[0], >- itemnumber => $itemnumber, >- biblionumber => $biblio->biblionumber, >- } >-)->store(); >-is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status}, >- 'itemAlreadyOnHold', >- "Patron cannot place a second item level hold for a given item" ); >-$hold->delete(); >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $biblio = $builder->build_sample_biblio; >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $reserveid1 = AddReserve( >+ { >+ branchcode => $library->branchcode, >+ borrowernumber => $patron->borrowernumber, >+ biblionumber => $biblio->biblionumber, >+ priority => 1 >+ } >+ ); > >-t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 0 ); >-ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'damaged', "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" ); >-ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" ); >+ my $itemnumber = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ biblionumber => $biblio->biblionumber, >+ damaged => 1 >+ } >+ )->itemnumber; >+ t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 1 ); >+ is( >+ CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}, >+ 'OK', >+ "Patron can reserve damaged item with AllowHoldsOnDamagedItems enabled" >+ ); >+ ok( >+ defined( ( CheckReserves($itemnumber) )[1] ), "Hold can be trapped for damaged item with AllowHoldsOnDamagedItems enabled" >+ ); >+ >+ $hold = Koha::Hold->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ itemnumber => $itemnumber, >+ biblionumber => $biblio->biblionumber, >+ } >+ )->store(); >+ is( >+ CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}, >+ 'itemAlreadyOnHold', >+ "Patron cannot place a second item level hold for a given item" >+ ); >+ $hold->delete(); >+ >+ t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 0 ); >+ is( >+ CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}, >+ 'damaged', >+ "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" >+ ); >+ ok( >+ !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" >+ ); >+ >+}; > > # Items that are not for loan, but holdable should not be trapped until they are available for loan > t::lib::Mocks::mock_preference( 'TrapHoldsOnOrder', 0 ); >-- >2.20.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 28206
: 120331 |
120332