From d6d806fb015caa1c02d570ab684738d417020b6c Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 22 Feb 2023 13:53:35 +0000 Subject: [PATCH] Bug 32057: (QA follow-up) Add a simple test Content-Type: text/plain; charset=utf-8 Signed-off-by: Marcel de Rooy --- t/db_dependent/Log.t | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Log.t b/t/db_dependent/Log.t index cfdbab3102..ed2334f853 100755 --- a/t/db_dependent/Log.t +++ b/t/db_dependent/Log.t @@ -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; -- 2.30.2