Bugzilla – Attachment 123914 Details for
Bug 28873
Incorrect age displayed in db_dependent/Koha/Patrons.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28873: Fix age displayed in db_dependent/Koha/Patrons.t
Bug-28873-Fix-age-displayed-in-dbdependentKohaPatr.patch (text/plain), 3.94 KB, created by
Fridolin Somers
on 2021-08-17 20:22:57 UTC
(
hide
)
Description:
Bug 28873: Fix age displayed in db_dependent/Koha/Patrons.t
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2021-08-17 20:22:57 UTC
Size:
3.94 KB
patch
obsolete
>From b421e65ecfecf8e8f0d9e98d664a0a5db474af8c Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Tue, 17 Aug 2021 10:19:29 -1000 >Subject: [PATCH] Bug 28873: Fix age displayed in db_dependent/Koha/Patrons.t > >In test suite db_dependent/Koha/Patrons.t actually shows : > > 1..10 > ok 1 - Patron with no dateofbirth is always valid for any category > ok 2 - Today=2020-02-28, dob=2015-03-01, is 5, should be valid=0 > ok 3 - Today=2020-02-28, dob=2015-02-27, is 5, should be valid=1 > ok 4 - Today=2020-02-28, dob=2009-02-28, is 11, should be valid=0 > ok 5 - Today=2020-02-28, dob=2015-02-28, is 7, should be valid=1 > ok 6 - Today=2020-02-28, dob=2009-02-27, is 11, should be valid=0 > ok 7 - Today=2020-02-28, dob=2016-08-27, is 3, should be valid=0 > ok 8 - Today=2020-02-28, dob=2009-03-01, is 11, should be valid=1 > ok 9 - Today=2020-02-28, dob=2007-08-27, is 12, should be valid=0 > ok 10 - Today=2020-02-28, dob=2015-02-28, is 5, should be valid=1 > >Some ages are incorrect : > >1) dob=2009-03-01, is 11 >=> it is age 10 >so valid=1 in category 5 to 10 > >2) dob=2015-03-01, is 5 >=> it is age 4 >so valid=0 in category 5 to 10 > >3) dob=2015-02-28, is 7 >=> this date of birth is already tested >I suppose here dob is wrong, age wanted is 7 in the middle of age restrictions. >so dob=2013-02-28 > >This patch fixes ages. >Also adds the category code 'AGE_5_10' in messages to display age limits > >Test plan : >Run prove -v t/db_dependent/Koha/Patrons.t without and with patch >--- > t/db_dependent/Koha/Patrons.t | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 59c6a8a075..152b80c35b 100755 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -788,7 +788,7 @@ subtest 'is_valid_age' => sub { > my $patron = $builder->build({ > source => 'Borrower', > value => { >- categorycode => 'AGE_5_10' >+ categorycode => $category->categorycode > } > }); > $patron = Koha::Patrons->find( $patron->{borrowernumber} ); >@@ -805,17 +805,17 @@ subtest 'is_valid_age' => sub { > add_m3_m6_m1 => > { date => '2016-08-27', expected_age => 3, valid => 0 }, > add_m7_m6_m1 => >- { date => '2015-02-28', expected_age => 7, valid => 1 }, >+ { date => '2013-02-28', expected_age => 7, valid => 1 }, > add_m5_0_0 => > { date => '2015-02-28', expected_age => 5, valid => 1 }, > add_m5_0_p1 => >- { date => '2015-03-01', expected_age => 5, valid => 0 }, >+ { date => '2015-03-01', expected_age => 4, valid => 0 }, > add_m5_0_m1 => > { date => '2015-02-27', expected_age => 5, valid => 1 }, > add_m11_0_0 => > { date => '2009-02-28', expected_age => 11, valid => 0 }, > add_m11_0_p1 => >- { date => '2009-03-01', expected_age => 11, valid => 1 }, >+ { date => '2009-03-01', expected_age => 10, valid => 1 }, > add_m11_0_m1 => > { date => '2009-02-27', expected_age => 11, valid => 0 }, > }, >@@ -827,7 +827,7 @@ subtest 'is_valid_age' => sub { > > Time::Fake->offset( $dt->epoch ); > >- for my $k ( keys %$date ) { >+ for my $k ( sort keys %$date ) { > next if $k eq 'today'; > > my $dob = $date->{$k}; >@@ -836,8 +836,8 @@ subtest 'is_valid_age' => sub { > $patron->is_valid_age, > $dob->{valid}, > sprintf( >- "Today=%s, dob=%s, is %s, should be valid=%s", >- $date->{today}, $dob->{date}, $dob->{expected_age}, $dob->{valid} >+ "Today=%s, dob=%s, is %s, should be valid=%s in category %s", >+ $date->{today}, $dob->{date}, $dob->{expected_age}, $dob->{valid}, $category->categorycode > ) > ); > } >-- >2.32.0
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 28873
:
123914
|
123915
|
123916