Lines 1-46
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
# |
2 |
# |
3 |
# Copyright 2011 MJ Ray and software.coop |
3 |
# This file is part of Koha. |
4 |
# Koha is free software; you can redistribute it and/or modify it |
|
|
5 |
# under the terms of the GNU General Public License as published by |
6 |
# the Free Software Foundation; either version 3 of the License, or |
7 |
# (at your option) any later version. |
8 |
# |
4 |
# |
9 |
# Koha is distributed in the hope that it will be useful, but |
5 |
# Koha is free software; you can redistribute it and/or modify it under the |
10 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
6 |
# terms of the GNU General Public License as published by the Free Software |
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7 |
# Foundation; either version 3 of the License, or (at your option) any later |
12 |
# GNU General Public License for more details. |
8 |
# version. |
13 |
# |
9 |
# |
14 |
# You should have received a copy of the GNU General Public License |
10 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
15 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
11 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
16 |
|
12 |
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
17 |
# This Koha test module is a stub! |
13 |
# |
18 |
# Add more tests here!!! |
14 |
# You should have received a copy of the GNU General Public License along |
|
|
15 |
# with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
16 |
|
20 |
use Modern::Perl; |
17 |
use Modern::Perl; |
21 |
use Test::More tests => 5; |
18 |
use Test::More tests => 5; |
22 |
|
19 |
|
23 |
use C4::Context; |
20 |
use C4::Context; |
|
|
21 |
use C4::Log; |
24 |
use Koha::Database; |
22 |
use Koha::Database; |
25 |
use Koha::DateUtils; |
23 |
use Koha::DateUtils; |
26 |
|
24 |
|
27 |
use t::lib::Mocks qw/mock_preference/; # to mock CronjobLog |
25 |
use t::lib::Mocks qw/mock_preference/; # to mock CronjobLog |
28 |
|
26 |
use t::lib::TestBuilder; |
29 |
$| = 1; |
|
|
30 |
|
31 |
BEGIN { |
32 |
use_ok('C4::Log'); |
33 |
} |
34 |
my $success; |
35 |
|
27 |
|
36 |
# Make sure we can rollback. |
28 |
# Make sure we can rollback. |
37 |
my $schema = Koha::Database->new->schema; |
29 |
our $schema = Koha::Database->new->schema; |
38 |
$schema->storage->txn_begin; |
30 |
$schema->storage->txn_begin; |
39 |
my $dbh = C4::Context->dbh; |
31 |
our $dbh = C4::Context->dbh; |
40 |
|
32 |
|
41 |
subtest 'Existing tests' => sub { |
33 |
subtest 'Existing tests' => sub { |
42 |
plan tests => 6; |
34 |
plan tests => 6; |
43 |
|
35 |
|
|
|
36 |
my $success; |
44 |
eval { |
37 |
eval { |
45 |
# FIXME: are we sure there is an member number 1? |
38 |
# FIXME: are we sure there is an member number 1? |
46 |
logaction("MEMBERS","MODIFY",1,"test operation"); |
39 |
logaction("MEMBERS","MODIFY",1,"test operation"); |
Lines 168-171
subtest 'GetLogs() respects interface filters' => sub {
Link Here
|
168 |
is( @{$logs}[0]->{ interface }, 'commandline', 'Interface correctly filtered (commandline)'); |
161 |
is( @{$logs}[0]->{ interface }, 'commandline', 'Interface correctly filtered (commandline)'); |
169 |
}; |
162 |
}; |
170 |
|
163 |
|
|
|
164 |
subtest 'GDPR logging' => sub { |
165 |
plan tests => 1; |
166 |
|
167 |
my $builder = t::lib::TestBuilder->new; |
168 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
169 |
|
170 |
t::lib::Mocks::mock_userenv({ patron => $patron }); |
171 |
logaction( 'AUTH', 'FAILURE', $patron->id, '', 'opac' ); |
172 |
my $logs = GetLogs( undef, undef, $patron->id, ['AUTH'], ['FAILURE'], $patron->id ); |
173 |
is( @$logs, 1, 'We should find one auth failure for this patron' ); |
174 |
|
175 |
}; |
176 |
|
171 |
$schema->storage->txn_rollback; |
177 |
$schema->storage->txn_rollback; |
172 |
- |
|
|