From 8dbf23a194f8b9c7e1610bbba507a8ce12b6e714 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Wed, 9 Nov 2016 09:59:50 +0000 Subject: [PATCH] Bug 17583: Add test for is_going_to _expired to be true --- t/db_dependent/Koha/Patrons.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t index 4914f32..8175a05 100644 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -188,7 +188,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; @@ -220,6 +220,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; }; -- 2.1.4