Bugzilla – Attachment 138683 Details for
Bug 30030
Test t/db_dependent/Koha/Patrons.t is_going_to_expire fails on U18
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30030: add 'invalid expiry date' tests, for every timezone
Bug-30030-add-invalid-expiry-date-tests-for-every-.patch (text/plain), 3.74 KB, created by
Mason James
on 2022-08-05 11:31:49 UTC
(
hide
)
Description:
Bug 30030: add 'invalid expiry date' tests, for every timezone
Filename:
MIME Type:
Creator:
Mason James
Created:
2022-08-05 11:31:49 UTC
Size:
3.74 KB
patch
obsolete
>From f2468dd6d0a80bbfa151d84bb1a678dc9b6ed275 Mon Sep 17 00:00:00 2001 >From: Mason James <mtj@kohaaloha.com> >Date: Fri, 5 Aug 2022 22:00:08 +1200 >Subject: [PATCH] Bug 30030: add 'invalid expiry date' tests, for every > timezone >Content-Type: text/plain; charset="utf-8" > >this patch aims to add 'invalid expiry date' tests, for every timezone > >to test... > >1/ apply patch > >2/ run test >root@kohadevbox:/kohadevbox/koha# prove -v t/db_dependent/Koha/Patrons.t >... > 1..368 > ... > ok 32 - On invalid "is going to expire" date, the method should not crash: America/Argentina/Buenos_Aires > ok 33 - On invalid "is going to expire" date, the method should not crash: America/Argentina/Catamarca > ok 34 - On invalid "is going to expire" date, the method should not crash: America/Argentina/Cordoba > ok 35 - On invalid "is going to expire" date, the method should not crash: America/Argentina/Jujuy > ok 36 - On invalid "is going to expire" date, the method should not crash: America/Argentina/La_Rioja > ok 37 - On invalid "is going to expire" date, the method should not crash: America/Argentina/Mendoza > ok 38 - On invalid "is going to expire" date, the method should not crash: America/Argentina/Rio_Gallegos > ok 39 - On invalid "is going to expire" date, the method should not crash: America/Argentina/Salta > ok 40 - On invalid "is going to expire" date, the method should not crash: America/Argentina/San_Juan > ok 41 - On invalid "is going to expire" date, the method should not crash: America/Argentina/San_Luis > ok 42 - On invalid "is going to expire" date, the method should not crash: America/Argentina/Tucuman > ok 43 - On invalid "is going to expire" date, the method should not crash: America/Argentina/Ushuaia > ... >All tests successful. >Files=1, Tests=44, 84 wallclock secs ( 0.17 usr 0.07 sys + 58.19 cusr 24.35 csys = 82.78 CPU) >Result: PASS > >3/ confirm all 'invalid expiry date' tests pass OK >--- > t/db_dependent/Koha/Patrons.t | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index c8b4d4f3d6..33564c114c 100755 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -25,6 +25,7 @@ use Test::Exception; > use Test::MockModule; > use Time::Fake; > use DateTime; >+use DateTime::TimeZone; > use JSON; > use utf8; > >@@ -299,7 +300,8 @@ subtest 'is_expired' => sub { > }; > > subtest 'is_going_to_expire' => sub { >- plan tests => 9; >+ my @tzones = DateTime::TimeZone->all_names; >+ plan tests => 8 + scalar @tzones; > > my $today = dt_from_string(undef, undef, 'floating'); > my $patron = $builder->build({ source => 'Borrower' }); >@@ -335,19 +337,20 @@ subtest 'is_going_to_expire' => sub { > $patron->dateexpiry( $today->clone->add( days => 10 ) )->store->discard_changes; > is( $patron->is_going_to_expire, 1, 'Patron should be considered going to expire if dateexpiry is 10 days ahead and pref is 20'); > >+ foreach my $tz (@tzones) { > { # Testing invalid is going to expiry date > t::lib::Mocks::mock_preference('NotifyBorrowerDeparture', 30); > # mock_config does not work here, because of tz vs timezone subroutines > my $context = Test::MockModule->new('C4::Context'); > $context->mock( 'tz', sub { >- 'America/Sao_Paulo'; >+ $tz; > }); > $patron->dateexpiry(DateTime->new( year => 2019, month => 12, day => 3 ))->store; > eval { $patron->is_going_to_expire }; >- is( $@, '', 'On invalid "is going to expire" date, the method should not crash with "Invalid local time for date in time zone"'); >+ is( $@, '', 'On invalid "is going to expire" date, the method should not crash: '.$tz ); > $context->unmock('tz'); > }; >- >+ } > $patron->delete; > }; > >-- >2.20.1
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 30030
: 138683