Bug 17583: Add test for is_going_to _expired to be true

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Josef Moravec 2016-11-09 09:59:50 +00:00 committed by Kyle M Hall
parent 57fd09f45c
commit e5ea08bead
1 changed files with 5 additions and 1 deletions

View File

@ -191,7 +191,7 @@ subtest 'is_expired' => sub {
};
subtest 'is_going_to_expired' => sub {
plan tests => 8;
plan tests => 9;
my $patron = $builder->build({ source => 'Borrower' });
$patron = Koha::Patrons->find( $patron->{borrowernumber} );
$patron->dateexpiry( undef )->store;
@ -223,6 +223,10 @@ subtest 'is_going_to_expired' => sub {
$patron->dateexpiry( dt_from_string->add( days => 20 ) )->store;
is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 20 days before and pref is 10');
t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 20);
$patron->dateexpiry( dt_from_string->add( days => 10 ) )->store;
is( $patron->is_going_to_expired, 1, 'Patron should be considered going to expire if dateexpiry is 10 days before and pref is 20');
$patron->delete;
};