Bug 22254: Correction to datehandling in test
Adding 13 months is not always the same as adding 1 month and then adding 12 months in DateTime maths. This patch rectified the test to match the correct behaviour in koha. Test plan. 1) Modify the test (around line 268) to test against the suspect leap date of 2019-01-31 and watch the test fail. 2) Apply the patch (which also adds this modification to test for such a leap date) and watch the test now pass. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> (cherry picked from commit1da0ba48b6) Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> (cherry picked from commit413f34ba24) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> (cherry picked from commit60f8ca789f) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
3a19cfad18
commit
28191756d1
|
|
@ -286,16 +286,16 @@ subtest 'is_going_to_expire' => sub {
|
|||
|
||||
|
||||
subtest 'renew_account' => sub {
|
||||
plan tests => 36;
|
||||
plan tests => 48;
|
||||
|
||||
for my $date ( '2016-03-31', '2016-11-30', dt_from_string() ) {
|
||||
for my $date ( '2016-03-31', '2016-11-30', '2019-01-31', dt_from_string() ) {
|
||||
my $dt = dt_from_string( $date, 'iso' );
|
||||
Time::Fake->offset( $dt->epoch );
|
||||
my $a_month_ago = $dt->clone->subtract( months => 1, end_of_month => 'limit' )->truncate( to => 'day' );
|
||||
my $a_year_later = $dt->clone->add( months => 12, end_of_month => 'limit' )->truncate( to => 'day' );
|
||||
my $a_year_later_minus_a_month = $dt->clone->add( months => 11, end_of_month => 'limit' )->truncate( to => 'day' );
|
||||
my $a_year_later_minus_a_month = $a_month_ago->clone->add( months => 12, end_of_month => 'limit' )->truncate( to => 'day' );
|
||||
my $a_month_later = $dt->clone->add( months => 1 , end_of_month => 'limit' )->truncate( to => 'day' );
|
||||
my $a_year_later_plus_a_month = $dt->clone->add( months => 13, end_of_month => 'limit' )->truncate( to => 'day' );
|
||||
my $a_year_later_plus_a_month = $a_month_later->clone->add( months => 12, end_of_month => 'limit' )->truncate( to => 'day' );
|
||||
my $patron_category = $builder->build(
|
||||
{ source => 'Category',
|
||||
value => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue