From 809a1dcfdd65d4a8137981e70b985f1b0965760d Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Wed, 10 Jun 2015 17:03:25 +0000 Subject: [PATCH] Bug 14334: t/db_dependent/Circulation.t AutoCommit fix There is no easy way to trigger an obvious problem. Confirmed with khall that tweaking those two other lines to ensure the autocommit fix will be correct. (http://irc.koha-community.org/koha/2015-06-10#i_1686796) TEST PLAN --------- 1) apply patch 2) git diff origin/master -- Are the additions/subtractions similar to http://paste.lisp.org/display/149194? 3) run koha qa test tools --- t/db_dependent/Circulation.t | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 30a5fe7..8b2b37a 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -34,10 +34,12 @@ BEGIN { } my $dbh = C4::Context->dbh; -my $schema = Koha::Database->new()->schema(); +my $database = Koha::Database->new(); +my $schema = $database->schema(); + # Start transaction -$dbh->{AutoCommit} = 0; +$schema->storage->txn_begin(); $dbh->{RaiseError} = 1; # Start with a clean slate @@ -302,7 +304,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); is( $renewokay, 1, 'Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds'); # Now let's add an item level hold, we should no longer be able to renew the item - my $hold = Koha::Database->new()->schema()->resultset('Reserve')->create( + my $hold = $schema->resultset('Reserve')->create( { borrowernumber => $hold_waiting_borrowernumber, biblionumber => $biblionumber, @@ -317,7 +319,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); # Now let's add a waiting hold on the 3rd item, it's no longer available tp check out by just anyone, so we should no longer # be able to renew these items - $hold = Koha::Database->new()->schema()->resultset('Reserve')->create( + $hold = $schema->resultset('Reserve')->create( { borrowernumber => $hold_waiting_borrowernumber, biblionumber => $biblionumber, @@ -594,6 +596,6 @@ C4::Context->dbh->do("DELETE FROM accountlines"); is ( $count, 0, "Calling UpdateFine on non-existant fine with an amount of 0 does not result in an empty fine" ); } -$dbh->rollback; +$schema->storage->txn_rollback(); 1; -- 2.1.4