Bugzilla – Attachment 171347 Details for
Bug 37898
All db dependent tests should run within a transaction
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37898: Wrap labels tests inside transactions
Bug-37898-Wrap-labels-tests-inside-transactions.patch (text/plain), 2.88 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-09-11 16:08:01 UTC
(
hide
)
Description:
Bug 37898: Wrap labels tests inside transactions
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-09-11 16:08:01 UTC
Size:
2.88 KB
patch
obsolete
>From e4ed529bc1c75e5750cd51746a606d5866097298 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 11 Sep 2024 12:48:28 -0300 >Subject: [PATCH] Bug 37898: Wrap labels tests inside transactions > >This tests are written in a way that the cleanup is done explicitly. So >I found no evidence of them leaving the database dirty. But it felt >worth wrapping anyway, because any dev adding something could easily >introduce new data inadvertedly. >--- > t/db_dependent/Labels/t_Layout.t | 6 ++++++ > t/db_dependent/Labels/t_Profile.t | 6 ++++++ > t/db_dependent/Labels/t_Template.t | 6 ++++++ > 3 files changed, 18 insertions(+) > >diff --git a/t/db_dependent/Labels/t_Layout.t b/t/db_dependent/Labels/t_Layout.t >index bf6209d099b..6271f125cdd 100755 >--- a/t/db_dependent/Labels/t_Layout.t >+++ b/t/db_dependent/Labels/t_Layout.t >@@ -20,12 +20,17 @@ > use Modern::Perl; > > use Test::More tests => 58; >+ > use C4::Context; >+use Koha::Database; > > BEGIN { > use_ok('C4::Labels::Layout'); > } > >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ > my $default_layout = { > barcode_type => 'CODE39', > callnum_split => 0, >@@ -118,3 +123,4 @@ is($updated_layout->get_text_wrap_cols(label_width => 180, left_text_margin => 1 > my $del_results = $updated_layout->delete(); > ok( ! defined($del_results) , "Layout->delete() success"); > >+$schema->storage->txn_rollback; >diff --git a/t/db_dependent/Labels/t_Profile.t b/t/db_dependent/Labels/t_Profile.t >index 40962523bc6..7139c7e4e0a 100755 >--- a/t/db_dependent/Labels/t_Profile.t >+++ b/t/db_dependent/Labels/t_Profile.t >@@ -20,12 +20,17 @@ > use Modern::Perl; > > use Test::More tests => 27; >+ > use C4::Context; >+use Koha::Database; > > BEGIN { > use_ok('C4::Labels::Profile'); > } > >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ > my $expected_profile = { > creator => 'Labels', > printer_name => 'Circulation Desk', >@@ -95,3 +100,4 @@ is_deeply($updated_profile, $saved_profile, "Updated layout object verify succes > my $del_results = $updated_profile->delete(); > ok($del_results ne -1, "Profile->delete() success"); > >+$schema->storage->txn_rollback; >diff --git a/t/db_dependent/Labels/t_Template.t b/t/db_dependent/Labels/t_Template.t >index 8cf4cd65cfc..98a04d30c9e 100755 >--- a/t/db_dependent/Labels/t_Template.t >+++ b/t/db_dependent/Labels/t_Template.t >@@ -20,12 +20,17 @@ > use Modern::Perl; > > use Test::More tests => 54; >+ > use C4::Context; >+use Koha::Database; > > BEGIN { > use_ok('C4::Labels::Template'); > } > >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ > my $expect_template = { > creator => 'Labels', > profile_id => 0, >@@ -135,3 +140,4 @@ foreach my $key (keys %{$expect_conv}) { > my $del_results = $updated_template->delete(); > ok($del_results ne -1, "Template->delete() success"); > >+$schema->storage->txn_rollback; >-- >2.46.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 37898
:
171346
|
171347
|
171348
|
171349
|
171353
|
171611
|
171612
|
171613
|
171614
|
171615