From 53377edcc7351935f8ff8bec838616479d59e358 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 Signed-off-by: Tomas Cohen Arazi --- 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 c0b00d733f..19490b3e76 100755 --- a/t/db_dependent/Koha/Patron.t +++ b/t/db_dependent/Koha/Patron.t @@ -1174,6 +1174,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 { @@ -1448,6 +1450,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' }); @@ -1459,10 +1462,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 => ''}}); @@ -1470,6 +1475,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 { @@ -1521,6 +1527,7 @@ subtest 'get_savings tests' => sub { }; subtest 'update privacy tests' => sub { + $schema->storage->txn_begin; plan tests => 5; @@ -1550,4 +1557,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.20.1