Bug 43071: Isolate holds_per_day-sensitive tests from ambient circulation rules
t/db_dependent/Holds.t, t/db_dependent/ILSDI_Services.t, and t/db_dependent/api/v1/holds.t all fail if a site has a global 'Holds Allowed (Daily)' circulation rule configured, because C4::Reserves::CanItemBeReserved checks holds_per_day before holds_per_record/reservesallowed, so an ambient daily-cap rule returns tooManyReservesToday and masks the status these tests actually exercise (tooManyReserves, noReservesAllowed, OK, or the API's hold_limit override). The affected subtests never set holds_per_day themselves, so they unintentionally depend on the database having no such rule configured. Test plan: 1. On a fresh db, set a global 'Holds Allowed (Daily)' circulation rule (Administration > Circulation and fine rules) to 1. 2. prove t/db_dependent/Holds.t t/db_dependent/ILSDI_Services.t t/db_dependent/api/v1/holds.t => fails before this patch, passes after. 3. Remove the circulation rule and re-run the same tests. => still passes (no regression for the default/unconfigured case). Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
cc1d8dd36f
commit
c049b9d7fe
|
|
@ -983,6 +983,9 @@ subtest 'CanItemBeReserved / holds_per_day tests' => sub {
|
|||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
# Remove any ambient holds_per_day rule so this test is isolated from site configuration
|
||||
Koha::CirculationRules->search( { rule_name => 'holds_per_day' } )->delete;
|
||||
|
||||
my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes' } );
|
||||
my $library = $builder->build_object( { class => 'Koha::Libraries' } );
|
||||
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
|
||||
|
|
@ -1744,6 +1747,10 @@ subtest 'CanItemBeReserved rule precedence tests' => sub {
|
|||
|
||||
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHomeLibrary' );
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
# Remove any ambient holds_per_day rule so this test is isolated from site configuration
|
||||
Koha::CirculationRules->search( { rule_name => 'holds_per_day' } )->delete;
|
||||
|
||||
my $library = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::Libraries',
|
||||
|
|
|
|||
|
|
@ -467,6 +467,9 @@ subtest 'Holds test' => sub {
|
|||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
# Remove any ambient holds_per_day rule so this test is isolated from site configuration
|
||||
Koha::CirculationRules->search( { rule_name => 'holds_per_day' } )->delete;
|
||||
|
||||
t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 0 );
|
||||
|
||||
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
|
||||
|
|
|
|||
|
|
@ -844,6 +844,9 @@ subtest 'add() + can_place_holds() tests' => sub {
|
|||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
# Remove any ambient holds_per_day rule so this test is isolated from site configuration
|
||||
Koha::CirculationRules->search( { rule_name => 'holds_per_day' } )->delete;
|
||||
|
||||
my $password = 'AbcdEFG123';
|
||||
|
||||
my $library = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } );
|
||||
|
|
|
|||
Loading…
Reference in New Issue