Lines 6-15
Link Here
|
6 |
|
6 |
|
7 |
use strict; |
7 |
use strict; |
8 |
use warnings; |
8 |
use warnings; |
9 |
use Test::More tests => 5; |
9 |
use Test::More tests => 7; |
10 |
|
10 |
|
11 |
# We need C4::Dates to handle the dates |
11 |
# We need C4::Dates to handle the dates |
12 |
use C4::Dates; |
12 |
use C4::Dates; |
|
|
13 |
use C4::Context; |
14 |
use t::lib::Mocks qw/mock_preference/; # to mock CronjobLog |
15 |
use Data::Dumper; |
16 |
|
17 |
$| = 1; |
13 |
|
18 |
|
14 |
BEGIN { |
19 |
BEGIN { |
15 |
use_ok('C4::Log'); |
20 |
use_ok('C4::Log'); |
Lines 53-55
eval {
Link Here
|
53 |
$success = 0; |
58 |
$success = 0; |
54 |
}; |
59 |
}; |
55 |
ok($success, "GetLogs seemed to find ".$success." like our test record in a tighter search"); |
60 |
ok($success, "GetLogs seemed to find ".$success." like our test record in a tighter search"); |
56 |
- |
61 |
|
|
|
62 |
# Make sure we can rollback. |
63 |
my $dbh = C4::Context->dbh; |
64 |
$dbh->{AutoCommit} = 0; |
65 |
$dbh->{RaiseError} = 1; |
66 |
|
67 |
# We want numbers to be the same between runs. |
68 |
$dbh->do("DELETE FROM action_logs;"); |
69 |
|
70 |
t::lib::Mocks::mock_preference('CronjobLog',0); |
71 |
cronlogaction(); |
72 |
my $cronJobCount = $dbh->selectrow_array("SELECT COUNT(*) FROM action_logs WHERE module='CRONJOBS';",{}); |
73 |
is($cronJobCount,0,"Cronjob not logged as expected."); |
74 |
|
75 |
t::lib::Mocks::mock_preference('CronjobLog',1); |
76 |
cronlogaction(); |
77 |
$cronJobCount = $dbh->selectrow_array("SELECT COUNT(*) FROM action_logs WHERE module='CRONJOBS';",{}); |
78 |
is($cronJobCount,1,"Cronjob logged as expected."); |
79 |
|
80 |
$dbh->rollback(); |