From ff8ce09abf325e66755ff9a7325462a1ed1cde49 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 7 Aug 2018 13:37:30 +0000 Subject: [PATCH] Bug 15408: Fix tests to fail without patch We set all the timestamps to a specified date and ensure the new budgets don't have this date Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens (cherry picked from commit fc55ecbe42a413ca1df54b34ec18597f01465522) Signed-off-by: Martin Renvoize --- t/db_dependent/Budgets.t | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t index 0e4d07d9cb..e3502d4519 100755 --- a/t/db_dependent/Budgets.t +++ b/t/db_dependent/Budgets.t @@ -12,6 +12,8 @@ use C4::Members qw( AddMember ); use Koha::Acquisition::Booksellers; use Koha::Acquisition::Orders; +use Koha::Acquisition::Funds; +use Koha::Patrons; use t::lib::TestBuilder; use Koha::DateUtils; @@ -477,6 +479,12 @@ is ( GetBudgetOrdered( $fund ), '20.000000', "total ordered price is 20"); # CloneBudgetPeriod +# Let's make sure our timestamp is old +my @orig_funds = Koha::Acquisition::Funds->search({ budget_period_id => $budget_period_id }); +foreach my $fund (@orig_funds){ + $fund->timestamp('1999-12-31 23:59:59')->store; +} + my $budget_period_id_cloned = C4::Budgets::CloneBudgetPeriod( { budget_period_id => $budget_period_id, @@ -490,12 +498,9 @@ my $budget_period_cloned = C4::Budgets::GetBudgetPeriod($budget_period_id_cloned is($budget_period_cloned->{budget_period_description}, 'Budget Period Cloned', 'Cloned budget\'s description is updated.'); my $budget_cloned = C4::Budgets::GetBudgets({ budget_period_id => $budget_period_id_cloned }); -my $test = $budget_cloned->[0]->{timestamp}; -my $budget_time = Koha::DateUtils::dt_from_string($test); -my $local_time = Koha::DateUtils::dt_from_string(); - +my $budget_time = $budget_cloned->[0]->{timestamp}; -is(DateTime::compare($budget_time, $local_time), 0, "New budget got the right timestamp"); +isnt($budget_time, '1999-12-31 23:59:59', "New budget has an updated timestamp"); -- 2.39.5