From 8943d5cbbf3deb00ee8f826a3f9788800db38a9f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 11 Oct 2016 13:15:27 +0100 Subject: [PATCH] Bug 17426: Do not set AutoCommit in tests git grep AutoCommit t | grep 1 highlights that 1 test use AutoCommit set, it should not The other change removes the FIXME should has been fixed. Test plan: prove t/db_dependent/BackgroundJob.t t/db_dependent/Patron/Borrower_Discharge.t should still return green Signed-off-by: Marc --- t/db_dependent/BackgroundJob.t | 2 +- t/db_dependent/Patron/Borrower_Discharge.t | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/t/db_dependent/BackgroundJob.t b/t/db_dependent/BackgroundJob.t index 3cc5348..7005594 100644 --- a/t/db_dependent/BackgroundJob.t +++ b/t/db_dependent/BackgroundJob.t @@ -12,7 +12,7 @@ my $query = new CGI; # Generate a session id my $dbh = C4::Context->dbh; -$dbh->{AutoCommit} = 1; +$dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; my $session = C4::Auth::get_session; diff --git a/t/db_dependent/Patron/Borrower_Discharge.t b/t/db_dependent/Patron/Borrower_Discharge.t index 9fde49c..d256f94 100644 --- a/t/db_dependent/Patron/Borrower_Discharge.t +++ b/t/db_dependent/Patron/Borrower_Discharge.t @@ -15,7 +15,7 @@ # with Koha; if not, see . use Modern::Perl; -use Test::More tests => 17; +use Test::More tests => 18; use Test::Warn; use MARC::Record; @@ -118,15 +118,8 @@ else { "Expected failure because of missing PDF::FromHTML."; } -# FIXME -# At this point, there is a problem with the AutoCommit off -# The transaction is bloked into DBIx::Class::Storage::DBI::_dbh_execute -# line my $rv = $sth->execute(); -# We are using 2 connections and the one used by Koha::Schema has the AutoCommit set to 1 -# Even if we switch off this flag, the connection will be blocked. -# The error is: -# DBIx::Class::ResultSet::create(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction [for Statement "INSERT INTO discharges ( borrower, needed, validated) VALUES ( ?, ?, ? )" with ParamValues: 0='121', 1='2014-01-08T16:38:29', 2=undef] at /home/koha/src/Koha/DataObject/Discharge.pm line 33 -#is( Koha::Service::Borrower::Discharge::request({ borrowernumber => $patron->{borrowernumber} }), 1, 'Discharge request sent' ); +# FIXME Should be a Koha::Object object +is( ref(Koha::Patron::Discharge::request({ borrowernumber => $patron->{borrowernumber} })), 'Koha::Schema::Result::Discharge', 'Discharge request sent' ); $schema->storage->txn_rollback; -- 2.1.4