3 # This Koha test module is a stub!
4 # Add more tests here!!!
8 use Test::More tests => 7;
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( keys get_saved_reports() );
32 is( $count, 0, "There is no report" );
33 my $sample_report1 = {
39 subgroup => 'subgroup1',
42 cache_expiry => 'null',
45 my $sample_report2 = {
51 subgroup => 'subgroup2',
54 cache_expiry => 'null',
57 my $report_id1 = save_report($sample_report1);
58 my $report_id2 = save_report($sample_report2);
59 like( $report_id1, '/^\d+$/', "Save_report returns an id" );
60 like( $report_id2, '/^\d+$/', "Save_report returns an id" );
61 is( scalar( keys get_saved_reports() ),
62 $count + 2, "Report1 and report2 have been added" );
65 #It would be better if delete_report has return values
66 delete_report( $report_id1, $report_id2 );
67 is( scalar( keys get_saved_reports() ),
68 $count, "Report1 and report2 have been deleted" );
70 #FIX ME: Currently, this test doesn't pass because delete_report doesn't test if one or more parameters are given
71 #is (deleted_report(),undef, "Without id deleted_report returns undef");