[Koha-bugs] [Bug 14334] New: DBI fighting DBIx over Autocommit in tests

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jun 4 21:35:06 CEST 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14334

            Bug ID: 14334
           Summary: DBI fighting DBIx over Autocommit in tests
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Test Suite
          Assignee: chris at bigballofwax.co.nz
          Reporter: mtompset at hotmail.com
        QA Contact: gmcharlt at gmail.com

As per an email on the KohaDev list, tcohen pointed out the problem.
gmcharlt pointed out a solution here: http://paste.lisp.org/display/149194
--- BEGIN PASTE ---
diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t
index f53e75b..8599c3f 100644
--- a/t/db_dependent/Letters.t
+++ b/t/db_dependent/Letters.t
@@ -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 at 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();
--- END PASTE ---

And I have volunteered to do it.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list