From a9eae1acdd8d1af564e052afcb8788b76e18a55b Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Tue, 2 Jul 2013 08:12:02 +0000 Subject: [PATCH] Bug 5349: Use DB transaction/rollback in unit tests --- t/db_dependent/Acquisition/TransferOrder.t | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/t/db_dependent/Acquisition/TransferOrder.t b/t/db_dependent/Acquisition/TransferOrder.t index fd294e2..7e39b77 100644 --- a/t/db_dependent/Acquisition/TransferOrder.t +++ b/t/db_dependent/Acquisition/TransferOrder.t @@ -2,7 +2,8 @@ use Modern::Perl; -use Test::More; +use Test::More tests => 6; +use C4::Context; use C4::Acquisition; use C4::Biblio; use C4::Items; @@ -10,6 +11,10 @@ use C4::Bookseller; use C4::Budgets; use MARC::Record; +my $dbh = C4::Context->dbh; +$dbh->{RaiseError} = 1; +$dbh->{AutoCommit} = 0; + my $booksellerid1 = C4::Bookseller::AddBookseller( { name => "my vendor 1", @@ -72,15 +77,4 @@ is(scalar GetOrders($basketno2), 1, "1 order in basket2"); ($order) = GetOrders($basketno2); is(scalar GetItemnumbersFromOrder($order->{ordernumber}), 1, "1 item in basket2's order"); -END { - C4::Acquisition::DelOrder( $biblionumber, $ordernumber ); - C4::Acquisition::DelOrder( $biblionumber, $newordernumber ); - C4::Budgets::DelBudget( $budgetid ); - C4::Acquisition::DelBasket( $basketno1 ); - C4::Bookseller::DelBookseller( $booksellerid1 ); - C4::Acquisition::DelBasket( $basketno2 ); - C4::Bookseller::DelBookseller( $booksellerid2 ); - C4::Biblio::DelBiblio($biblionumber); -}; - -done_testing; +$dbh->rollback; -- 1.7.10.4