From 4a325fda1dad1e2e4bfca044b2097a1b239d0cf3 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Tue, 6 Dec 2016 21:07:56 +0000 Subject: [PATCH] Bug 17742: Fix t/db_dependent/Patrons.t Moves the getting of testing date for updated_on just after the storing the test patron data to make the gap between generating data and now date as short as possible Changes test #7 to the one which was probably originally intended Test plan 1. prove t/db_dependent/Patrons.t 2. read the diff Signed-off-by: Chris Kirby Tests passed. --- t/db_dependent/Patrons.t | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t index 24707df..0cee4b8 100755 --- a/t/db_dependent/Patrons.t +++ b/t/db_dependent/Patrons.t @@ -50,6 +50,7 @@ my $b1 = Koha::Patron->new( } ); $b1->store(); +my $now = dt_from_string; my $b2 = Koha::Patron->new( { surname => 'Test 2', @@ -72,13 +73,13 @@ $b3->store(); my $b1_new = Koha::Patrons->find( $b1->borrowernumber() ); is( $b1->surname(), $b1_new->surname(), "Found matching patron" ); isnt( $b1_new->updated_on, undef, "borrowers.updated_on should be set" ); -is( dt_from_string($b1_new->updated_on), dt_from_string, "borrowers.updated_on should have been set to now on creating" ); +is( dt_from_string($b1_new->updated_on), $now, "borrowers.updated_on should have been set to now on creating" ); my $b3_new = Koha::Patrons->find( $b3->borrowernumber() ); is( dt_from_string($b3_new->updated_on), $three_days_ago, "borrowers.updated_on should have been kept to what we set on creating" ); $b3_new->set({ surname => 'another surname for Test 3' }); $b3_new = Koha::Patrons->find( $b3->borrowernumber() ); -is( dt_from_string($b1_new->updated_on), dt_from_string, "borrowers.updated_on should have been set to now on updating" ); +is( $b3_new->surname, 'Test 3', "borrowers.surname should have not been updated with set without store" ); my @patrons = Koha::Patrons->search( { branchcode => $branchcode } ); is( @patrons, 3, "Found 3 patrons with Search" ); -- 1.9.1