From 02cd82ddba6233b7be0ca74d5fb6eea5790d3867 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 22 Sep 2023 14:14:02 +0000 Subject: [PATCH] Bug 34887: Fix transactions in db dependent Patron.t Signed-off-by: Marcel de Rooy --- t/db_dependent/Koha/Patron.t | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t index 85a6ae61984..574dfa1096f 100755 --- a/t/db_dependent/Koha/Patron.t +++ b/t/db_dependent/Koha/Patron.t @@ -1172,6 +1172,8 @@ subtest 'safe_to_delete() tests' => sub { ok( $patron->safe_to_delete, 'Can delete, all conditions met' ); my $messages = $patron->safe_to_delete->messages; is_deeply( $messages, [], 'Patron can be deleted, no messages' ); + + $schema->storage->txn_rollback; }; subtest 'article_request_fee() tests' => sub { @@ -1446,6 +1448,7 @@ subtest 'notify_library_of_registration()' => sub { subtest 'notice_email_address' => sub { plan tests => 2; + $schema->storage->txn_begin; my $patron = $builder->build_object({ class => 'Koha::Patrons' }); @@ -1457,10 +1460,12 @@ subtest 'notice_email_address' => sub { is ($patron->notice_email_address, $patron->emailpro, "Koha::Patron->notice_email_address returns correct value when EmailFieldPrimary is emailpro"); $patron->delete; + $schema->storage->txn_rollback; }; subtest 'first_valid_email_address' => sub { plan tests => 1; + $schema->storage->txn_begin; my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { emailpro => ''}}); @@ -1468,6 +1473,7 @@ subtest 'first_valid_email_address' => sub { is ($patron->first_valid_email_address, $patron->email, "Koha::Patron->first_valid_email_address returns correct value when EmailFieldPrecedence is 'emailpro|email' and emailpro is empty"); $patron->delete; + $schema->storage->txn_rollback; }; subtest 'get_savings tests' => sub { @@ -1519,6 +1525,7 @@ subtest 'get_savings tests' => sub { }; subtest 'update privacy tests' => sub { + $schema->storage->txn_begin; plan tests => 5; @@ -1548,4 +1555,6 @@ subtest 'update privacy tests' => sub { is( $old_checkout->borrowernumber, $anon_patron->id, "Checkout is successfully anonymized"); is( $patron->privacy(), 2, "Patron privacy is successfully updated"); + + $schema->storage->txn_rollback; }; -- 2.25.1