Bug 9907 - Plugins test dies early on some servers
[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
11 # We need C4::Dates to handle the dates
12 use C4::Dates;
13
14 BEGIN {
15         use_ok('C4::Log');
16 }
17 my $success;
18
19 eval {
20     # FIXME: are we sure there is an member number 1?
21     # FIXME: can we remove this log entry somehow?
22     logaction("MEMBERS","MODIFY",1,"test operation");
23     $success = 1;
24 } or do {
25     diag($@);
26     $success = 0;
27 };
28 ok($success, "logaction seemed to work");
29
30 eval {
31     # FIXME: US formatted date hardcoded into test for now
32     $success = scalar(@{GetLogs("","","",undef,undef,"","")});
33 } or do {
34     diag($@);
35     $success = 0;
36 };
37 ok($success, "GetLogs returns results for an open search");
38
39 eval {
40     # FIXME: US formatted date hardcoded into test for now
41     my $date = C4::Dates->new();
42     $success = scalar(@{GetLogs($date->today(),$date->today(),"",undef,undef,"","")});
43 } or do {
44     diag($@);
45     $success = 0;
46 };
47 ok($success, "GetLogs accepts dates in an All-matching search");
48
49 eval {
50     $success = scalar(@{GetLogs("","","",["MEMBERS"],["MODIFY"],1,"")});
51 } or do {
52     diag($@);
53     $success = 0;
54 };
55 ok($success, "GetLogs seemed to find ".$success." like our test record in a tighter search");