Bugzilla – Attachment 65627 Details for
Bug 18900
Wrong number format in receiving order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED OFF] Bug 18900 - add UT to Number/Price.t
SIGNED-OFF-Bug-18900---add-UT-to-NumberPricet.patch (text/plain), 2.01 KB, created by
Katrin Fischer
on 2017-08-08 11:55:44 UTC
(
hide
)
Description:
[SIGNED OFF] Bug 18900 - add UT to Number/Price.t
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2017-08-08 11:55:44 UTC
Size:
2.01 KB
patch
obsolete
>From 1e0bf82e7824f38137c721208315c8f6e1bbe400 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Thu, 6 Jul 2017 08:44:51 +0200 >Subject: [PATCH] [SIGNED OFF] Bug 18900 - add UT to Number/Price.t > >This patch adds unit tests to t/Number/Price.t in order to valid the problem. > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/Number/Price.t | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > >diff --git a/t/Number/Price.t b/t/Number/Price.t >index ad4f0cf..99d23bc 100644 >--- a/t/Number/Price.t >+++ b/t/Number/Price.t >@@ -1,16 +1,21 @@ > use Modern::Perl; > >-use Test::More tests => 28; >+use Test::More tests => 30; > > use Test::MockModule; > use t::lib::Mocks; > >+# Number formating depends by default on system environement >+# See http://search.cpan.org/~wrw/Number-Format/Format.pm >+use POSIX qw(setlocale LC_NUMERIC); >+ > use Koha::Acquisition::Currencies; > my $budget_module = Test::MockModule->new('Koha::Acquisition::Currencies'); > my $currency; > $budget_module->mock( 'get_active', sub { return $currency; } ); > use_ok('Koha::Number::Price'); > >+my $orig_locale = setlocale(LC_NUMERIC); > my $format = { > p_cs_precedes => 1, # Force to place the symbol at the beginning > p_sep_by_space => 0, # Force to not add a space between the symbol and the number >@@ -44,6 +49,14 @@ is( Koha::Number::Price->new(3)->unformat, '3', 'US: unformat 3' ); > is( Koha::Number::Price->new(1234567890)->unformat, > '1234567890', 'US: unformat 1234567890' ); > >+# Bug 18900 - Check params are not from system environement >+setlocale(LC_NUMERIC, "fr_FR.UTF-8"); >+is( Koha::Number::Price->new(12345678.9)->format( { %$format, with_symbol => 1 } ), >+ '12,345,678.90', 'US: format 12,345,678.90 with symbol' ); >+is( Koha::Number::Price->new('12,345,678.90')->unformat, >+ '12345678.9', 'US: unformat 12345678.9' ); >+setlocale(LC_NUMERIC, $orig_locale); >+ > t::lib::Mocks::mock_preference( 'CurrencyFormat', 'FR' ); > $currency = Koha::Acquisition::Currency->new({ > currency => 'EUR', >-- >2.7.4
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 18900
:
64838
|
64839
|
64840
|
65627
|
65628
|
65759
|
65760
|
65761