Bug 6460: alternative fix, updating template and script instead of C4::Log
[koha.git] / t / db_dependent / Log.t
1 #!/usr/bin/perl
2 #
3 # Copyright 2011 MJ Ray and software.coop
4 # This Koha test module is a stub!  
5 # Add more tests here!!!
6
7 use strict;
8 use warnings;
9 use Test::More tests => 5;
10 use C4::Log;
11
12 BEGIN {
13         use_ok('C4::Log');
14 }
15 my $success;
16
17 eval {
18     # FIXME: are we sure there is an member number 1?
19     # FIXME: can we remove this log entry somehow?
20     logaction("MEMBERS","MODIFY",1,"test operation");
21     $success = 1;
22 } or do {
23     diag($@);
24     $success = 0;
25 };
26 ok($success, "logaction seemed to work");
27
28 eval {
29     # FIXME: US formatted date hardcoded into test for now
30     $success = scalar(@{GetLogs("","","",undef,undef,"","")});
31 } or do {
32     diag($@);
33     $success = 0;
34 };
35 ok($success, "GetLogs returns results for an open search");
36
37 eval {
38     # FIXME: US formatted date hardcoded into test for now
39     $success = scalar(@{GetLogs("09/01/2011","10/01/2011","",undef,undef,"","")});
40 } or do {
41     diag($@);
42     $success = 0;
43 };
44 ok($success, "GetLogs accepts dates in an All-matching search");
45
46 eval {
47     $success = scalar(@{GetLogs("","","",["MEMBERS"],["MODIFY"],1,"")});
48 } or do {
49     diag($@);
50     $success = 0;
51 };
52 ok($success, "GetLogs seemed to find ".$success." like our test record in a tighter search");