From 128d0027741d5fbc21157542043ff997d374a6ad Mon Sep 17 00:00:00 2001 From: Kenza Zaki Date: Thu, 11 Jul 2013 16:28:11 +0200 Subject: [PATCH] GetOrdersByBiblionumber.t needs a database transaction Before this patch, the queries in GetOrdersByBiblionumber.t were commited in the database and have to be removed at the end. This patch wraps tests in a database transaction. Test Plan : prove t/db_dependent/Acquisition/GetOrdersByBiblionumber.t t/db_dependent/Acquisition/GetOrdersByBiblionumber.t .. ok All tests successful. Files=1, Tests=3, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.37 cusr 0.05 csys = 0.45 CPU) Result: PASS http://bugs.koha-community.org/show_bug.cgi?id=10575 --- .../Acquisition/GetOrdersByBiblionumber.t | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/t/db_dependent/Acquisition/GetOrdersByBiblionumber.t b/t/db_dependent/Acquisition/GetOrdersByBiblionumber.t index c801dd7..8bd0735 100644 --- a/t/db_dependent/Acquisition/GetOrdersByBiblionumber.t +++ b/t/db_dependent/Acquisition/GetOrdersByBiblionumber.t @@ -9,6 +9,11 @@ use C4::Bookseller; use C4::Budgets; use MARC::Record; +#Start transaction +my $dbh = C4::Context->dbh; +$dbh->{AutoCommit} = 0; +$dbh->{RaiseError} = 1; + my $booksellerid = C4::Bookseller::AddBookseller( { name => "my vendor", @@ -70,15 +75,7 @@ is(scalar(@orders), 1, '1 order on biblionumber 1'); @orders = GetOrdersByBiblionumber( $biblionumber2 ); is(scalar(@orders), 2, '2 orders on biblionumber 2'); -END { - C4::Acquisition::DelOrder( 1, $ordernumber1 ); - C4::Acquisition::DelOrder( 2, $ordernumber2 ); - C4::Acquisition::DelOrder( 3, $ordernumber3 ); - C4::Budgets::DelBudget( $budgetid ); - C4::Acquisition::DelBasket( $basketno ); - C4::Bookseller::DelBookseller( $booksellerid ); - C4::Biblio::DelBiblio($biblionumber1); - C4::Biblio::DelBiblio($biblionumber2); -}; +#End transaction +$dbh->rollback; done_testing; -- 1.7.9.5