Bug 27824: Add a test
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
780d6ecb51
commit
a91e80af7d
1 changed files with 7 additions and 1 deletions
|
@ -49,7 +49,7 @@ $retrieved_report_1->delete;
|
||||||
is( Koha::Reports->search->count, $nb_of_reports + 1, 'Delete should have deleted the report' );
|
is( Koha::Reports->search->count, $nb_of_reports + 1, 'Delete should have deleted the report' );
|
||||||
|
|
||||||
subtest 'prep_report' => sub {
|
subtest 'prep_report' => sub {
|
||||||
plan tests => 3;
|
plan tests => 4;
|
||||||
|
|
||||||
my $report = Koha::Report->new({
|
my $report = Koha::Report->new({
|
||||||
report_name => 'report_name_for_test_1',
|
report_name => 'report_name_for_test_1',
|
||||||
|
@ -68,6 +68,12 @@ subtest 'prep_report' => sub {
|
||||||
($sql, undef) = $report->prep_report( [],["1\n12\n\r243",'the other',"42\n32\n22\n12"] );
|
($sql, undef) = $report->prep_report( [],["1\n12\n\r243",'the other',"42\n32\n22\n12"] );
|
||||||
is( $sql, qq{SELECT * FROM items WHERE itemnumber IN ('1','12','243') AND 'the other' AND ('42','32','22','12') /* saved_sql.id: $id */},'Expected sql generated correctly with multiple params and no names');
|
is( $sql, qq{SELECT * FROM items WHERE itemnumber IN ('1','12','243') AND 'the other' AND ('42','32','22','12') /* saved_sql.id: $id */},'Expected sql generated correctly with multiple params and no names');
|
||||||
|
|
||||||
|
$report->savedsql(
|
||||||
|
q{SELECT i.itemnumber, i.itemnumber as Exemplarnummber, [[i.itemnumber| itemnumber for batch]] FROM items})
|
||||||
|
->store;
|
||||||
|
my $headers;
|
||||||
|
( $sql, $headers ) = $report->prep_report( [], [] );
|
||||||
|
is_deeply( $headers, { 'itemnumber for batch' => 'itemnumber' } );
|
||||||
};
|
};
|
||||||
|
|
||||||
$schema->storage->txn_rollback;
|
$schema->storage->txn_rollback;
|
||||||
|
|
Loading…
Reference in a new issue