From 600217eb69abf8218b68c32b8eaca223c87ceec3 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 Signed-off-by: Martin Renvoize --- Koha/Database.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Koha/Database.pm b/Koha/Database.pm index ae1d254de9..ab325cc513 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.39.5