From 1001001565553ec543177bafaaad21354564aafc Mon Sep 17 00:00:00 2001
From: Alex Arnaud <alex.arnaud@biblibre.com>
Date: Tue, 15 Nov 2016 10:30:16 +0000
Subject: [PATCH] Bug 6979 - Fix Already in a transaction error

---
 t/db_dependent/Auth_with_ldap.t | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/t/db_dependent/Auth_with_ldap.t b/t/db_dependent/Auth_with_ldap.t
index f191a6c..8819eca 100755
--- a/t/db_dependent/Auth_with_ldap.t
+++ b/t/db_dependent/Auth_with_ldap.t
@@ -27,11 +27,12 @@ use C4::Context;
 
 use Koha::Patrons;
 
-my $dbh = C4::Context->dbh;
+my $dbh = '';
 
 # Start transaction
-$dbh->{AutoCommit} = 0;
-$dbh->{RaiseError} = 1;
+my $database = Koha::Database->new();
+my $schema = $database->schema();
+$schema->storage->txn_begin();
 
 my $builder = t::lib::TestBuilder->new();
 
@@ -382,7 +383,7 @@ sub mock_net_ldap {
         'search',
         sub {
 
-            $remaining_entry = 1
+            $remaining_entry = 1;
 
             return mock_net_ldap_search(
                 {
@@ -479,6 +480,6 @@ sub is_admin_bind {
     return 0;
 }
 
-$dbh->rollback;
+$schema->storage->txn_rollback();
 
 1;
-- 
2.7.4