Bug 43203: Correctly rollback test data

Test plan:
1) In the database, verify how many biblios exist (select count(*) from biblio;)
2) Run prove t/db_dependent/Koha/Item.t
3) Check the count again, there should now be 3 extra bib records left from the test run
4) Apply patch
5) Repeat the process, the biblio count should never grow after test runs

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Matt Blenkinsop 2026-07-30 11:39:51 +01:00 committed by Pedro Amorim
parent fbfccfdbf2
commit dca7313511
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 8 additions and 0 deletions

View File

@ -406,6 +406,8 @@ subtest 'return_claim accessor' => sub {
subtest 'tracked_links relationship' => sub {
plan tests => 3;
$schema->storage->txn_begin;
my $biblio = $builder->build_sample_biblio();
my $item = $builder->build_sample_item(
{
@ -419,6 +421,8 @@ subtest 'tracked_links relationship' => sub {
my $link2 = $builder->build( { source => 'Linktracker', value => { itemnumber => $item->itemnumber } } );
is( $item->tracked_links()->count, 2, "Two tracked links found" );
$schema->storage->txn_rollback;
};
subtest 'is_bundle tests' => sub {
@ -1273,6 +1277,8 @@ subtest 'store check barcodes' => sub {
$item->barcode(undef)->store();
$item->discard_changes;
is( $item->barcode, undef, 'undef barcodes remain undef' );
$schema->storage->txn_rollback;
};
subtest 'deletion' => sub {
@ -2196,6 +2202,8 @@ subtest 'Tests for relationship between item and item_orders via aqorders_item'
$orders = $item->orders;
is( $orders->count, 1, 'One order found by item with the relationship' );
is( $orders->next->order_internalnote, $order_note, 'Correct order found by item with the relationship' );
$schema->storage->txn_rollback;
};
subtest 'move_to_biblio() tests' => sub {