Bug 31920: Add transaction to subtest in t/db_dependent/Holds.t

A subest in t/db_dependent/Holds.t leaves behind database cruft.

Test Plan:
Using koha-testing-docker:
1) SELECT branchcode FROM branches
2) prove t/db_dependent/Holds.t
3) SELECT branchcode FROM branches
   Note cruft
4) reset_all
2) prove t/db_dependent/Holds.t
3) SELECT branchcode FROM branches
   No cruft!

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2b8b02a587)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 992d2b01f7)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
Kyle Hall 2022-10-21 11:31:09 -04:00 committed by Arthur Suzuki
parent 2798a650b4
commit a5080a81c0
1 changed files with 6 additions and 1 deletions

View File

@ -1682,6 +1682,9 @@ subtest 'ModReserve can only update expirationdate for found holds' => sub {
subtest 'Koha::Holds->get_items_that_can_fill returns items with datecancelled or (inclusive) datearrived' => sub {
plan tests => 8;
$schema->storage->txn_begin;
# biblio item with date arrived and date cancelled
my $biblio1 = $builder->build_sample_biblio();
my $item1 = $builder->build_sample_item({ biblionumber => $biblio1->biblionumber });
@ -1768,4 +1771,6 @@ subtest 'Koha::Holds->get_items_that_can_fill returns items with datecancelled o
is($items_that_can_fill3->count, 1, "Koha::Holds->get_items_that_can_fill returns 1 item with correct parameters");
is($items_that_can_fill4->next, undef, "Koha::Holds->get_items_that_can_fill doesn't return item with undefined datearrived and undefined datecancelled");
is($items_that_can_fill4->count, 0, "Koha::Holds->get_items_that_can_fill returns 0 item");
}
$schema->storage->txn_rollback;
};