Bug 39748: Add unit test

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
David Cook 2026-04-13 02:13:03 +00:00 committed by Lucas Gass
parent 0fb44d7ab5
commit e0859f245f
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 25 additions and 0 deletions

View File

@ -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;