Bug 24329: Add a test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2020-01-05 23:08:28 +01:00 committed by Martin Renvoize
parent 99593d9e85
commit eba0050d7e
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 8 additions and 1 deletions

View File

@ -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;
};