From 2998a7ef284f32a30972f63e711b59b4f317abb9 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Wed, 18 Dec 2024 11:33:56 -0300
Subject: [PATCH] Bug 38744: Wrap tests in Biblio.t inside a transaction
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
---
t/db_dependent/Koha/Biblio.t | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t
index 0576acca567..90e8ed68c74 100755
--- a/t/db_dependent/Koha/Biblio.t
+++ b/t/db_dependent/Koha/Biblio.t
@@ -1697,9 +1697,12 @@ subtest 'item_groups() tests' => sub {
$schema->storage->txn_rollback;
};
-subtest 'normalized_isbn' => sub {
+subtest 'normalized_isbn() tests' => sub {
+
plan tests => 1;
+ $schema->storage->txn_begin;
+
# We will move the tests from GetNormalizedISBN here when it will get replaced
my $biblio = $builder->build_sample_biblio();
$biblio->biblioitem->set( { isbn => '9781250067128 | 125006712X' } )->store;
@@ -1707,11 +1710,16 @@ subtest 'normalized_isbn' => sub {
$biblio->normalized_isbn, C4::Koha::GetNormalizedISBN( $biblio->biblioitem->isbn ),
'normalized_isbn is a wrapper around C4::Koha::GetNormalizedISBN'
);
+
+ $schema->storage->txn_rollback;
};
-subtest 'normalized_upc' => sub {
+subtest 'normalized_upc() tests' => sub {
+
plan tests => 1;
+ $schema->storage->txn_begin;
+
# We will move the tests from GetNormalizedUPC here when it will get replaced
# Note that only a single test exist and it's not really meaningful...
my $biblio = $builder->build_sample_biblio();
@@ -1719,11 +1727,16 @@ subtest 'normalized_upc' => sub {
$biblio->normalized_upc, C4::Koha::GetNormalizedUPC( $biblio->metadata->record ),
'normalized_upc is a wrapper around C4::Koha::GetNormalizedUPC'
);
+
+ $schema->storage->txn_rollback;
};
-subtest 'normalized_oclc' => sub {
+subtest 'normalized_oclc() tests' => sub {
+
plan tests => 1;
+ $schema->storage->txn_begin;
+
# We will move the tests from GetNormalizedOCLC here when it will get replaced
# Note that only a single test exist and it's not really meaningful...
my $biblio = $builder->build_sample_biblio();
@@ -1731,6 +1744,8 @@ subtest 'normalized_oclc' => sub {
$biblio->normalized_oclc, C4::Koha::GetNormalizedOCLCNumber( $biblio->metadata->record ),
'normalized_oclc is a wrapper around C4::Koha::GetNormalizedOCLCNumber'
);
+
+ $schema->storage->txn_rollback;
};
subtest 'ratings' => sub {
@@ -1743,6 +1758,8 @@ subtest 'opac_summary_html' => sub {
plan tests => 2;
+ $schema->storage->txn_begin;
+
my $author = 'my author';
my $title = 'my title';
my $isbn = '9781250067128 | 125006712X';
@@ -1761,6 +1778,8 @@ subtest 'opac_summary_html' => sub {
sprintf( 'Replace %s, %s, %s AND %s please', $author, $title, $biblio->normalized_isbn, $biblio->biblionumber ),
'opac_summary_html replaces the different patterns'
);
+
+ $schema->storage->txn_rollback;
};
subtest 'can_be_edited() tests' => sub {
--
2.34.1