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 <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Galen Charlton 2014-05-08 16:09:07 +00:00
parent 6973e3b7d5
commit 795700d8f0

View file

@ -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;