3 # This Koha test module is a stub!
4 # Add more tests here!!!
8 use Test
::More tests
=> 12;
13 use_ok
('C4::Reports::Guided');
16 'C4::Reports::Guided',
22 my $dbh = C4
::Context
->dbh;
23 $dbh->{RaiseError
} = 1;
24 $dbh->{AutoCommit
} = 0;
26 $dbh->do(q
|DELETE FROM saved_sql
|);
31 my $count = scalar( @
{ get_saved_reports
() } );
32 is
( $count, 0, "There is no report" );
35 for my $id ( 1 .. 3 ) {
36 push @report_ids, save_report
({
37 borrowernumber
=> $id,
42 subgroup
=> "subgroup$id",
45 cache_expiry
=> "null",
50 like
( $report_ids[0], '/^\d+$/', "Save_report returns an id for first" );
51 like
( $report_ids[1], '/^\d+$/', "Save_report returns an id for second" );
52 like
( $report_ids[2], '/^\d+$/', "Save_report returns an id for third" );
54 is
( scalar( @
{ get_saved_reports
() } ),
55 $count, "$count reports have been added" );
58 is
(delete_report
(),undef, "Without id delete_report returns undef");
60 is
( delete_report
( $report_ids[0] ), 1, "report 1 is deleted" );
63 is
( scalar( @
{ get_saved_reports
() } ), $count, "Report1 has been deleted" );
65 is
( delete_report
( $report_ids[1], $report_ids[2] ), 2, "report 2 and 3 are deleted" );
68 is
( scalar( @
{ get_saved_reports
() } ),
69 $count, "Report2 and report3 have been deleted" );