From 6dc3cceaa180243e941813c5f375588742050536 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 14 Nov 2018 09:37:58 -0300 Subject: [PATCH] Bug 21829: Add tests for dateexpiry format in notices Signed-off-by: Kyle M Hall --- t/db_dependent/Letters.t | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t index f758bbc9be..09e35e3312 100644 --- a/t/db_dependent/Letters.t +++ b/t/db_dependent/Letters.t @@ -354,6 +354,21 @@ $dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('orde is( $values->{dateexpiry}, '2015-12-13', "_parseletter doesn't modify its parameters" ); } +# Correctly format dateexpiry +{ + my $values = { dateexpiry => '2015-12-13', }; + + t::lib::Mocks::mock_preference('dateformat', 'metric'); + t::lib::Mocks::mock_preference('timeformat', '24hr'); + my $letter = C4::Letters::_parseletter({ content => "expiry on <>"}, 'borrowers', $values); + is( $letter->{content}, 'expiry on 13/12/2015' ); + + t::lib::Mocks::mock_preference('dateformat', 'metric'); + t::lib::Mocks::mock_preference('timeformat', '12hr'); + $letter = C4::Letters::_parseletter({ content => "expiry on <>"}, 'borrowers', $values); + is( $letter->{content}, 'expiry on 13/12/2015' ); +} + my $bookseller = Koha::Acquisition::Bookseller->new( { name => "my vendor", -- 2.17.2 (Apple Git-113)