From e0859f245f7fd9541fbbdd3e7b9500d671305643 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 13 Apr 2026 02:13:03 +0000 Subject: [PATCH] Bug 39748: Add unit test Signed-off-by: David Nind Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer Signed-off-by: Lucas Gass --- t/db_dependent/Koha/Patrons.t | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t index 78b4f56c33..faa3c22ef1 100755 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -356,6 +356,31 @@ subtest 'is_expired' => sub { $patron->delete; }; +subtest 'DST is_expired' => sub { + plan tests => 2; + + my $context = Test::MockModule->new('C4::Context'); + $context->mock( + 'tz', + sub { + 'Africa/Cairo'; + } + ); + + Time::Fake->offset(1745580600); + my $patron = $builder->build( { source => 'Borrower' } ); + $patron = Koha::Patrons->find( $patron->{borrowernumber} ); + $patron->dateexpiry('2025-04-24 23:59:59'); + is( $patron->is_expired, 1, 'Patron should be expired as they expire the day before today' ); + + $patron->dateexpiry('2025-04-25 00:00:01'); + is( $patron->is_expired, 0, 'Patron should not be expired as they expire the same day as today' ); + + $context->unmock('tz'); + Time::Fake->reset(); + +}; + subtest 'is_going_to_expire' => sub { plan tests => 9;