From 865843866f0a72e15d46e018a448cbdf1c57bb2c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 6 Aug 2019 09:44:40 -0500 Subject: [PATCH] Bug 22741: Add a test Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize (cherry picked from commit 75168e4ae5bad0806f96a39ce38f5f3f04e96c51) Signed-off-by: Fridolin Somers --- t/db_dependent/Koha/Patrons.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t index b0e2bd8763..ed902ec021 100644 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -26,11 +26,13 @@ use Test::MockModule; use Time::Fake; use DateTime; use JSON; +use Data::Dumper; use C4::Circulation; use C4::Biblio; use C4::Auth qw(checkpw_hash); +use Koha::ActionLogs; use Koha::Holds; use Koha::Patrons; use Koha::Patron::Categories; @@ -1526,7 +1528,7 @@ subtest 'Test Koha::Patrons::merge' => sub { }; subtest '->store' => sub { - plan tests => 5; + plan tests => 6; my $schema = Koha::Database->new->schema; $schema->storage->txn_begin; @@ -1563,6 +1565,17 @@ subtest '->store' => sub { $schema->storage->dbh->{PrintError} = $print_error; $schema->storage->txn_rollback; + + subtest 'skip updated_on for BorrowersLog' => sub { + plan tests => 1; + $schema->storage->txn_begin; + t::lib::Mocks::mock_preference('BorrowersLog', 1); + my $patron = $builder->build_object({ class => 'Koha::Patrons' }); + $patron->updated_on(dt_from_string($patron->updated_on)->add( seconds => 1 ))->store; + my $logs = Koha::ActionLogs->search({ module =>'MEMBERS', action => 'MODIFY', object => $patron->borrowernumber }); + is($logs->count, 0, '->store should not have generated a log for updated_on') or diag 'Log generated:'.Dumper($logs->unblessed); + $schema->storage->txn_rollback; + }; }; subtest '->set_password' => sub { -- 2.20.1