Bug 10575 : 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

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 45fafb31ce)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Kenza Zaki 2013-07-11 16:28:11 +02:00 committed by Tomas Cohen Arazi
parent 3b6abb0ea1
commit a89699cc66
1 changed files with 7 additions and 10 deletions

View File

@ -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;