Bug 32057: (QA follow-up) Add a simple test

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marcel de Rooy 2023-02-22 13:53:35 +00:00 committed by Tomas Cohen Arazi
parent 557c09b466
commit 1aec933e36
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 16 additions and 1 deletions

View File

@ -16,7 +16,7 @@
use Modern::Perl;
use Data::Dumper qw( Dumper );
use Test::More tests => 4;
use Test::More tests => 5;
use C4::Context;
use C4::Log qw( logaction cronlogaction );
@ -90,6 +90,21 @@ subtest 'logaction(): interface is correctly logged' => sub {
is( $log->interface, 'sip', 'Passed interface is respected (sip)');
};
subtest 'logaction / trace' => sub {
plan tests => 2;
C4::Context->interface( 'intranet' );
t::lib::Mocks::mock_preference('ActionLogsTraceDepth',0);
logaction( "MEMBERS", "MODIFY", 1, "test1");
is( Koha::ActionLogs->search({ info => 'test1' })->last->trace, undef, 'No trace at level 0' );
t::lib::Mocks::mock_preference('ActionLogsTraceDepth',2);
logaction( "MEMBERS", "MODIFY", 1, "test2");
like( Koha::ActionLogs->search({ info => 'test2' })->last->trace, qr/("line":.*){2}/, 'Found two trace levels' );
t::lib::Mocks::mock_preference('ActionLogsTraceDepth',0);
};
subtest 'GDPR logging' => sub {
plan tests => 6;