Bug 19532: (RM follow-up) Fix dates compare in recalls tests
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
9c6741cbe3
commit
c38017ff8c
2 changed files with 6 additions and 4 deletions
|
@ -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" );
|
||||
|
|
|
@ -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" );
|
||||
|
|
Loading…
Reference in a new issue