Bug 8435: (follow-up) use a transaction for unit tests
authorJonathan Druart <jonathan.druart@biblibre.com>
Fri, 28 Jun 2013 07:27:39 +0000 (09:27 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 31 Oct 2013 15:29:25 +0000 (15:29 +0000)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
t/db_dependent/Serials_2.t

index 7c37dee..83bcbf8 100644 (file)
@@ -6,6 +6,10 @@ use Test::More tests => 4;
 use_ok('C4::Serials');
 use_ok('C4::Budgets');
 
+my $dbh = C4::Context->dbh;
+$dbh->{AutoCommit} = 0;
+$dbh->{RaiseError} = 1;
+
 my $supplierlist=eval{GetSuppliersWithLateIssues()};
 ok(length($@)==0,"No SQL problem in GetSuppliersWithLateIssues");
 
@@ -58,8 +62,4 @@ my $subscription = GetSubscription( $subscriptionid );
 is( C4::Serials::can_edit_subscription($subscription), 1, "User can edit a subscription with an empty branchcode");
 #TODO add UT when C4::Auth->set_permissions (or setuserflags) will exist.
 
-
-# cleaning
-DelSubscription( $subscription->{subscriptionid} );
-DelBudgetPeriod($bpid);
-DelBudget($budget_id);
+$dbh->rollback;