Bugzilla – Attachment 182785 Details for
Bug 36625
t/db_dependent/Koha/Biblio.t leaves test data in the database
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36625: Run subtests in txn - Koha/Biblio.t
Bug-36625-Run-subtests-in-txn---KohaBibliot.patch (text/plain), 4.47 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-05-26 14:42:51 UTC
(
hide
)
Description:
Bug 36625: Run subtests in txn - Koha/Biblio.t
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-05-26 14:42:51 UTC
Size:
4.47 KB
patch
obsolete
>From 7418327e715b976fca62d56470e14e03cc92bfae Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 26 May 2025 12:33:44 +0200 >Subject: [PATCH] Bug 36625: Run subtests in txn - Koha/Biblio.t > >Test plan: >select count(*) from itemtypes; >run the tests >exectute the select query again >=> No itemtypes should have been created > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Biblio.t | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index 7cdf7989cca..59c6a5f6f08 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -915,6 +915,8 @@ subtest 'get_marc_components() tests' => sub { > subtest 'get_components_query' => sub { > plan tests => 12; > >+ $schema->storage->txn_begin; >+ > my $biblio = $builder->build_sample_biblio(); > my $biblionumber = $biblio->biblionumber; > my $record = $biblio->metadata->record; >@@ -959,11 +961,16 @@ subtest 'get_components_query' => sub { > is( $comp_sort, "title_asc", "$engine: UseControlNumber enabled with MarcOrgCode sort if correct" ); > $record->delete_field($marc_003_field); > } >+ >+ $schema->storage->txn_rollback; >+ > }; > > subtest 'get_volumes_query' => sub { > plan tests => 3; > >+ $schema->storage->txn_begin; >+ > my $biblio = $builder->build_sample_biblio(); > my $biblionumber = $biblio->biblionumber; > my $record = $biblio->metadata->record; >@@ -1003,6 +1010,9 @@ subtest 'get_volumes_query' => sub { > "(((rcn:$biblionumber AND cni:OSt) OR rcn:\"OSt $biblionumber\") NOT (bib-level:a OR bib-level:b))", > "UseControlNumber enabled with MarcOrgCode" > ); >+ >+ $schema->storage->txn_rollback; >+ > }; > > subtest 'generate_marc_host_field' => sub { >@@ -1811,6 +1821,8 @@ subtest 'item_groups() tests' => sub { > subtest 'normalized_isbn' => 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; >@@ -1818,11 +1830,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 { > 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(); >@@ -1830,11 +1847,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 { > 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(); >@@ -1842,6 +1864,9 @@ 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 'opac_suppressed() tests' => sub { >@@ -1885,14 +1910,20 @@ subtest 'opac_suppressed() tests' => sub { > subtest 'ratings' => sub { > plan tests => 1; > >+ $schema->storage->txn_begin; >+ > # See t/db_dependent/Koha/Ratings.t > ok(1); >+ >+ $schema->storage->txn_rollback; > }; > > subtest 'opac_summary_html' => sub { > > plan tests => 2; > >+ $schema->storage->txn_begin; >+ > my $author = 'my author'; > my $title = 'my title'; > my $isbn = '9781250067128 | 125006712X'; >@@ -1911,6 +1942,9 @@ 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.49.0
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 36625
:
182782
| 182785 |
182786