Lines 257-263
subtest 'get_saved_reports' => sub {
Link Here
|
257 |
warning_like {local $dbh->{RaiseError} = 0; ($sth, $errors) = execute_query( |
257 |
warning_like {local $dbh->{RaiseError} = 0; ($sth, $errors) = execute_query( |
258 |
'SELECT surname FRM borrowers', # error in the query is intentional |
258 |
'SELECT surname FRM borrowers', # error in the query is intentional |
259 |
0, 10 ) } |
259 |
0, 10 ) } |
260 |
qr/^DBD::mysql::st execute failed: You have an error in your SQL syntax;/, |
260 |
qr/DBD::mysql::st execute failed: You have an error in your SQL syntax;/, |
261 |
"Wrong SQL syntax raises warning"; |
261 |
"Wrong SQL syntax raises warning"; |
262 |
ok( |
262 |
ok( |
263 |
defined($errors) && exists($errors->{queryerr}), |
263 |
defined($errors) && exists($errors->{queryerr}), |
Lines 400-406
subtest 'Email report test' => sub {
Link Here
|
400 |
|
400 |
|
401 |
# for next test, we want to let execute_query capture any SQL errors |
401 |
# for next test, we want to let execute_query capture any SQL errors |
402 |
warning_like { local $dbh->{RaiseError} = 0; ($emails, $errors ) = C4::Reports::Guided::EmailReport({report_id => $report2, module => $letter1->{module} , code => $letter1->{code} }) } |
402 |
warning_like { local $dbh->{RaiseError} = 0; ($emails, $errors ) = C4::Reports::Guided::EmailReport({report_id => $report2, module => $letter1->{module} , code => $letter1->{code} }) } |
403 |
qr/^DBD::mysql::st execute failed/, |
403 |
qr/DBD::mysql::st execute failed/, |
404 |
'Error from bad report'; |
404 |
'Error from bad report'; |
405 |
is( $errors->[0]{FATAL}, 'REPORT_FAIL', "Bad report returns failure"); |
405 |
is( $errors->[0]{FATAL}, 'REPORT_FAIL', "Bad report returns failure"); |
406 |
|
406 |
|
Lines 452-459
subtest 'nb_rows() tests' => sub {
Link Here
|
452 |
# for next test, we want to let execute_query capture any SQL errors |
452 |
# for next test, we want to let execute_query capture any SQL errors |
453 |
|
453 |
|
454 |
warning_like |
454 |
warning_like |
455 |
{ local $dbh->{RaiseError} = 0; $nb_rows = nb_rows( $bad_query ) } |
455 |
{ $nb_rows = nb_rows( $bad_query ) } |
456 |
qr/^DBD::mysql::st execute failed:/, |
456 |
qr/DBD::mysql::st execute failed:/, |
457 |
'Bad queries raise a warning'; |
457 |
'Bad queries raise a warning'; |
458 |
|
458 |
|
459 |
is( $nb_rows, 0, 'nb_rows returns 0 on bad queries' ); |
459 |
is( $nb_rows, 0, 'nb_rows returns 0 on bad queries' ); |