Bug 14334: t/db_dependent/Letters.t AutoCommit fix
authorGalen Charlton <gmcharlt@gmail.com>
Thu, 4 Jun 2015 20:11:44 +0000 (16:11 -0400)
committerTomas Cohen Arazi <tomascohen@theke.io>
Sun, 7 Jun 2015 21:51:22 +0000 (18:51 -0300)
TEST PLAN
----------
1) git reset --hard origin/master
2) prove t/db_dependent/Letters.t
   -- horrible failure about transaction
3) apply this patch
4) prove t/db_dependent/Letters.t
   -- no issues
5) koha qa test tools.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
t/db_dependent/Letters.t

index f53e75b..8599c3f 100644 (file)
@@ -45,11 +45,15 @@ use t::lib::Mocks;
 use Koha::DateUtils qw( dt_from_string output_pref );
 use Koha::Acquisition::Order;
 use Koha::Acquisition::Bookseller;
+use Koha::Database;
 
 my $dbh = C4::Context->dbh;
 
+my $database = Koha::Database->new();
+my $schema = $database->schema();
+$schema->storage->txn_begin();
+
 # Start transaction
-$dbh->{AutoCommit} = 0;
 $dbh->{RaiseError} = 1;
 
 $dbh->do(q|DELETE FROM letter|);
@@ -341,4 +345,4 @@ is($err, 1, "Successfully sent claim");
 is($mail{'To'}, 'testemail@mydomain.com', "mailto correct in sent claim");
 is($mail{'Message'}, 'my vendor|John Smith|Ordernumber ' . $ordernumber . ' (Silence in the library) (1 ordered)', 'Claim notice text constructed successfully');
 
-$dbh->rollback;
+$schema->storage->txn_rollback();