Bugzilla – Attachment 174386 Details for
Bug 38418
SIP/Transaction.t fails if wrong `dateformat` set
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38418: Make SIP/Transaction.t run on all dateformat values
Bug-38418-Make-SIPTransactiont-run-on-all-dateform.patch (text/plain), 2.61 KB, created by
David Nind
on 2024-11-11 18:25:30 UTC
(
hide
)
Description:
Bug 38418: Make SIP/Transaction.t run on all dateformat values
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-11-11 18:25:30 UTC
Size:
2.61 KB
patch
obsolete
>From b366705d7faf6daf97a3610425c1bc6df6a68197 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 11 Nov 2024 13:48:51 -0300 >Subject: [PATCH] Bug 38418: Make SIP/Transaction.t run on all dateformat > values > >To test: >1. Change the `dateformat` syspref to any value other than `us`(shows as mm/dd/yyyy) >2. Run: > $ ktd --shell > k$ prove t/db_dependent/SIP/Transaction.t >=> FAIL: Tests fail because of the resulting string containing an unexpected date format. >3. Repeat 1-2 with other formats >=> FAIL: SAme >4. Choose `us` >5. Repeat 2 >=> SUCCESS: It passes >6. Apply this patch >7. Repeat 2 >=> SUCCESS: Tests pass! > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/SIP/Transaction.t | 23 +++++++++++++++++++---- > 1 file changed, 19 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index 65c5060093..b259e4f9bf 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -7,6 +7,8 @@ use Modern::Perl; > use Test::More tests => 19; > use Test::Warn; > >+use DateTime; >+ > use Koha::Database; > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -771,7 +773,8 @@ subtest do_checkout_with_sysprefs_override => sub { > }; > > subtest do_checkout_with_patron_blocked => sub { >- plan tests => 5; >+ >+ plan tests => 8; > > my $mockILS = Test::MockObject->new; > my $server = { ils => $mockILS }; >@@ -804,17 +807,29 @@ subtest do_checkout_with_patron_blocked => sub { > } > ); > >+ my $date_expiry = DateTime->new( year => 2020, month => 1, day => 3 ); >+ > my $expired_patron = $builder->build_object( > { > class => 'Koha::Patrons', > value => { > branchcode => $library->branchcode, >- dateexpiry => '2020/01/03', >+ dateexpiry => $date_expiry, > } > } > ); >- my $circ = $ils->checkout( $expired_patron->cardnumber, $item->barcode ); >- is( $circ->{screen_msg}, 'Patron expired on 01/03/2020', "Got correct expired screen message" ); >+ >+ my $circ; >+ >+ foreach my $dateformat (qw{metric us iso dmydot}) { >+ t::lib::Mocks::mock_preference( 'dateformat', $dateformat ); >+ $circ = $ils->checkout( $expired_patron->cardnumber, $item->barcode ); >+ is( >+ $circ->{screen_msg}, >+ 'Patron expired on ' . output_pref( { dt => dt_from_string( $date_expiry, 'iso' ), dateonly => 1 } ), >+ "Got correct expired screen message" >+ ); >+ } > > my $fines_patron = $builder->build_object( > { >-- >2.39.5
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 38418
:
174384
|
174386
|
174449