Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 4; |
20 |
use Test::More tests => 5; |
21 |
|
21 |
|
22 |
use Koha::Report; |
22 |
use Koha::Report; |
23 |
use Koha::Reports; |
23 |
use Koha::Reports; |
Lines 49-51
$retrieved_report_1->delete;
Link Here
|
49 |
is( Koha::Reports->search->count, $nb_of_reports + 1, 'Delete should have deleted the report' ); |
49 |
is( Koha::Reports->search->count, $nb_of_reports + 1, 'Delete should have deleted the report' ); |
50 |
|
50 |
|
51 |
$schema->storage->txn_rollback; |
51 |
$schema->storage->txn_rollback; |
52 |
- |
52 |
|
|
|
53 |
subtest 'validate_sql' => sub { |
54 |
plan tests => 3 + 6*2; |
55 |
my @badwords = ('UPDATE', 'DELETE', 'DROP', 'INSERT', 'SHOW', 'CREATE'); |
56 |
is_deeply( Koha::Reports->validate_sql(), [{ queryerr => 'Missing SELECT'}], 'Empty sql is missing SELECT' ); |
57 |
is_deeply( Koha::Reports->validate_sql('FOO'), [{ queryerr => 'Missing SELECT'}], 'Nonsense sql is missing SELECT' ); |
58 |
is_deeply( Koha::Reports->validate_sql('select FOO'), [], 'select FOO is good' ); |
59 |
foreach my $word (@badwords) { |
60 |
is_deeply( Koha::Reports->validate_sql('select FOO;'.$word.' BAR'), [{ sqlerr => $word}], 'select FOO with '.$word.' BAR' ); |
61 |
is_deeply( Koha::Reports->validate_sql($word.' qux'), [{ sqlerr => $word}], $word.' qux' ); |
62 |
} |
63 |
} |