From 795700d8f084b1512f2b972ebb76d0110c48e818 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 8 May 2014 16:09:07 +0000 Subject: [PATCH] Bug 12214: add regression test for reporting error when running report with SQL error To test: [1] Run prove -v t/db_dependent/Reports_Guided.t. Last test should fail. [2] Apply the main patch. [3] Run step 1 again. This time, all tests should pass. Signed-off-by: Galen Charlton Signed-off-by: Kyle M Hall Signed-off-by: Galen Charlton --- t/db_dependent/Reports_Guided.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Reports_Guided.t b/t/db_dependent/Reports_Guided.t index ad34dbd2a8..6633c2fb53 100755 --- a/t/db_dependent/Reports_Guided.t +++ b/t/db_dependent/Reports_Guided.t @@ -5,7 +5,7 @@ use Modern::Perl; -use Test::More tests => 14; +use Test::More tests => 15; use C4::Context; @@ -85,6 +85,19 @@ is_deeply( 'running a query with a parameter returned the expected result' ); +# for next test, we want to let execute_query capture any SQL errors +$dbh->{RaiseError} = 0; +my $errors; +($sth, $errors) = execute_query( + 'SELECT surname FRM borrowers', # error in the query is intentional + 0, + 10, +); +ok( + defined($errors) && exists($errors->{queryerr}), + 'attempting to run a report with an SQL syntax error returns error message (Bug 12214)' +); + #End transaction $dbh->rollback; -- 2.39.5