From c38017ff8cc976d45f9c8451a927add4c256b9e6 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 17 Mar 2022 22:56:04 -1000 Subject: [PATCH] Bug 19532: (RM follow-up) Fix dates compare in recalls tests Signed-off-by: Fridolin Somers --- t/db_dependent/Koha/Recall.t | 5 +++-- t/db_dependent/Koha/Recalls.t | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/Koha/Recall.t b/t/db_dependent/Koha/Recall.t index 0805b4af79..a3e155f756 100755 --- a/t/db_dependent/Koha/Recall.t +++ b/t/db_dependent/Koha/Recall.t @@ -18,6 +18,7 @@ use Modern::Perl; use Test::More tests => 27; +use t::lib::Dates; use t::lib::TestBuilder; use t::lib::Mocks; @@ -112,7 +113,7 @@ Koha::CirculationRules->set_rule({ t::lib::Mocks::mock_preference( 'RecallsMaxPickUpDelay', 7 ); my $expected_expirationdate = dt_from_string->add({ days => 7 }); my $expirationdate = $recall2->calc_expirationdate; -is( $expirationdate, $expected_expirationdate, "Expiration date calculated based on system preference as no circulation rules are set" ); +is( t::lib::Dates::compare( $expirationdate, $expected_expirationdate ), 0, "Expiration date calculated based on system preference as no circulation rules are set" ); Koha::CirculationRules->set_rule({ branchcode => undef, @@ -123,7 +124,7 @@ Koha::CirculationRules->set_rule({ }); $expected_expirationdate = dt_from_string->add({ days => 3 }); $expirationdate = $recall2->calc_expirationdate; -is( $expirationdate, $expected_expirationdate, "Expiration date calculated based on circulation rules" ); +is( t::lib::Dates::compare( $expirationdate, $expected_expirationdate ), 0, "Expiration date calculated based on circulation rules" ); $recall2->set_waiting({ expirationdate => $expirationdate }); is( $recall2->waiting, 1, "Recall is waiting" ); diff --git a/t/db_dependent/Koha/Recalls.t b/t/db_dependent/Koha/Recalls.t index 610a84a4e2..567dc5f05c 100755 --- a/t/db_dependent/Koha/Recalls.t +++ b/t/db_dependent/Koha/Recalls.t @@ -18,6 +18,7 @@ use Modern::Perl; use Test::More tests => 20; +use t::lib::Dates; use t::lib::TestBuilder; use t::lib::Mocks; @@ -136,8 +137,8 @@ is( $due_interval, 3, "Recall due date interval is based on circulation rules" ) is( $recall->item_level_recall, 0, "No item provided so recall not flagged as item-level" ); my $expected_due_date = dt_from_string->add( days => 3 ); -is( dt_from_string( $recall->checkout->date_due ), $expected_due_date, "Checkout due date has correctly been extended by recall_due_date_interval days" ); -is( $due_date, $expected_due_date, "Due date correctly returned" ); +is( t::lib::Dates::compare( $recall->checkout->date_due, $expected_due_date ), 0, "Checkout due date has correctly been extended by recall_due_date_interval days" ); +is( t::lib::Dates::compare( $due_date, $expected_due_date ), 0, "Due date correctly returned" ); my $messages_count = Koha::Notice::Messages->search({ borrowernumber => $patron3->borrowernumber, letter_code => 'RETURN_RECALLED_ITEM' })->count; is( $messages_count, 3, "RETURN_RECALLED_ITEM notice successfully sent to checkout borrower" ); -- 2.39.2