Bugzilla – Attachment 57526 Details for
Bug 17583
Use Koha::Patron->is_expired from circulation.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 17583: Fix tests
SIGNED-OFF-Bug-17583-Fix-tests.patch (text/plain), 3.76 KB, created by
Josef Moravec
on 2016-11-16 08:06:06 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 17583: Fix tests
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2016-11-16 08:06:06 UTC
Size:
3.76 KB
patch
obsolete
>From b336db6b9e514ef3a42d30bb18768ae15bfa28ee Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 9 Nov 2016 11:25:16 +0000 >Subject: [PATCH] [SIGNED-OFF] Bug 17583: Fix tests > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > Koha/Patron.pm | 3 ++- > t/db_dependent/Koha/Patrons.t | 13 ++++++------- > 2 files changed, 8 insertions(+), 8 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 057db0a..5fb6fac 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -295,9 +295,10 @@ sub is_going_to_expired { > > my $delay = C4::Context->preference('NotifyBorrowerDeparture') || 0; > >+ return 0 unless $delay; > return 0 unless $self->dateexpiry; > return 0 if $self->dateexpiry eq '0000-00-00'; >- return 1 if dt_from_string( $self->dateexpiry )->add( days => $delay ) < dt_from_string; >+ return 1 if dt_from_string( $self->dateexpiry )->add( days => -$delay ) < dt_from_string; > return 0; > } > >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 1c5185e..0641594 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -195,30 +195,29 @@ subtest 'is_going_to_expired' => sub { > is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is today'); > > t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 0); >- my $dt_from_string = dt_from_string; >- $patron->dateexpiry( $dt_from_string )->store; >+ $patron->dateexpiry( dt_from_string )->store; > is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is today and pref is 0'); > > t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 10); > $patron->dateexpiry( dt_from_string->add( days => 11 ) )->store; >- is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 11 days before and pref is 10'); >+ is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 11 days ahead and pref is 10'); > > t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 0); > $patron->dateexpiry( dt_from_string->add( days => 10 ) )->store; >- is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 10 days before and pref is 0'); >+ is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 10 days ahead and pref is 0'); > > t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 10); > $patron->dateexpiry( dt_from_string->add( days => 10 ) )->store; >- is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 10 days before and pref is 10'); >+ is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 10 days ahead and pref is 10'); > $patron->delete; > > t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 10); > $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'); >+ is( $patron->is_going_to_expired, 0, 'Patron should not be considered going to expire if dateexpiry is 20 days ahead 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'); >+ is( $patron->is_going_to_expired, 1, 'Patron should be considered going to expire if dateexpiry is 10 days ahead and pref is 20'); > > $patron->delete; > }; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17583
:
57329
|
57330
|
57334
|
57364
|
57380
|
57384
|
57387
|
57488
|
57523
|
57524
|
57525
|
57526
|
57527
|
57528
|
57888
|
57889
|
57890
|
57891
|
57892
|
57893
|
57914
|
57915
|
57916
|
57917
|
57918
|
57919
|
57920