Lines 4-12
Link Here
|
4 |
# This Koha test module is a stub! |
4 |
# This Koha test module is a stub! |
5 |
# Add more tests here!!! |
5 |
# Add more tests here!!! |
6 |
|
6 |
|
7 |
use strict; |
7 |
use Modern::Perl; |
8 |
use warnings; |
8 |
use Test::More tests => 8; |
9 |
use Test::More tests => 7; |
|
|
10 |
|
9 |
|
11 |
use C4::Context; |
10 |
use C4::Context; |
12 |
use Koha::DateUtils; |
11 |
use Koha::DateUtils; |
Lines 77-80
cronlogaction();
Link Here
|
77 |
$cronJobCount = $dbh->selectrow_array("SELECT COUNT(*) FROM action_logs WHERE module='CRONJOBS';",{}); |
76 |
$cronJobCount = $dbh->selectrow_array("SELECT COUNT(*) FROM action_logs WHERE module='CRONJOBS';",{}); |
78 |
is($cronJobCount,1,"Cronjob logged as expected."); |
77 |
is($cronJobCount,1,"Cronjob logged as expected."); |
79 |
|
78 |
|
|
|
79 |
subtest "GetLogs should return all logs if dates are not set" => sub { |
80 |
plan tests => 2; |
81 |
my $today = dt_from_string->add(minutes => -1); |
82 |
my $yesterday = dt_from_string->add( days => -1 ); |
83 |
$dbh->do(q| |
84 |
INSERT INTO action_logs (timestamp, user, module, action, object, info) |
85 |
VALUES |
86 |
(?, 42, 'CATALOGUING', 'MODIFY', 4242, 'Record 42 has been modified by patron 4242 yesterday'), |
87 |
(?, 43, 'CATALOGUING', 'MODIFY', 4242, 'Record 43 has been modified by patron 4242 today') |
88 |
|, undef, output_pref({dt =>$yesterday, dateformat => 'iso'}), output_pref({dt => $today, dateformat => 'iso'})); |
89 |
my $logs = GetLogs( undef, undef, undef, ['CATALOGUING'], ['MODIFY'], 4242 ); |
90 |
is( scalar(@$logs), 2, 'GetLogs should return all logs regardless the dates' ); |
91 |
$logs = GetLogs( output_pref($today), undef, undef, ['CATALOGUING'], ['MODIFY'], 4242 ); |
92 |
is( scalar(@$logs), 1, 'GetLogs should return the logs for today' ); |
93 |
}; |
94 |
|
80 |
$dbh->rollback(); |
95 |
$dbh->rollback(); |
81 |
- |
|
|