From be086e0e2cf0b06cf0e95be85863a676015eff42 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sun, 5 Jan 2020 23:08:28 +0100 Subject: [PATCH] Bug 24329: Add a test Signed-off-by: Jonathan Druart --- t/db_dependent/Koha/ActionLogs.t | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/ActionLogs.t b/t/db_dependent/Koha/ActionLogs.t index 894c8afd5d..24bce1b7ea 100644 --- a/t/db_dependent/Koha/ActionLogs.t +++ b/t/db_dependent/Koha/ActionLogs.t @@ -22,6 +22,7 @@ use Test::More tests => 3; use C4::Context; use C4::Log; use Koha::Database; +use Koha::DateUtils qw( dt_from_string ); use t::lib::TestBuilder; @@ -33,7 +34,7 @@ my $schema = Koha::Database->new->schema; my $builder = t::lib::TestBuilder->new; subtest 'store() tests' => sub { - plan tests => 2; + plan tests => 3; $schema->storage->txn_begin; @@ -48,6 +49,12 @@ subtest 'store() tests' => sub { is( ref($log), 'Koha::ActionLog', 'Log object creation success'); is( Koha::ActionLogs->count, $logs_count + 1, 'Exactly one log was saved'); + my $yesterday = dt_from_string->subtract( days => 1 ); + $log->timestamp($yesterday)->store; + $log->info("a new info")->store; # Must be 2 different store calls + is( dt_from_string( $log->get_from_storage->timestamp ), $yesterday, + 'timestamp column should not be updated to current_timestamp' ); + $schema->storage->txn_rollback; }; -- 2.11.0