From a5afc97027f7927378ae48b2697e33ad95a48f04 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 14 Dec 2018 13:30:02 -0300 Subject: [PATCH] Bug 22001: Enable RaiseError for tests --- Koha/Database.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Koha/Database.pm b/Koha/Database.pm index c04c60921c..900f941289 100644 --- a/Koha/Database.pm +++ b/Koha/Database.pm @@ -86,13 +86,15 @@ sub _new_schema { $encoding_query = "set client_encoding = 'UTF8';"; $tz_query = qq(SET TIME ZONE = "$tz") if $tz; } + + my $RaiseError = ( $ENV{DEBUG} || exists $ENV{_} && $ENV{_} =~ m|prove| ) ? 1 : 0; my $schema = Koha::Schema->connect( { dsn => "dbi:$db_driver:database=$db_name;host=$db_host;port=$db_port".($tls_options? $tls_options : ""), user => $db_user, password => $db_passwd, %encoding_attr, - RaiseError => $ENV{DEBUG} ? 1 : 0, + RaiseError => $RaiseError, PrintError => 1, unsafe => 1, quote_names => 1, @@ -114,7 +116,7 @@ sub _new_schema { $dbh->do(q| SELECT * FROM systempreferences WHERE 1 = 0 | ); - $dbh->{RaiseError} = $ENV{DEBUG} ? 1 : 0; + $dbh->{RaiseError} = $RaiseError }; $dbh->{RaiseError} = 0 if $@; -- 2.11.0