Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
76ade0f6
Commit
76ade0f6
authored
Sep 30, 2014
by
Serge Bezborodov
Committed by
Carsten Brandt
Oct 01, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed order of attributes setting in Formatter
close #5261
parent
0818c9bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
Formatter.php
framework/i18n/Formatter.php
+6
-6
FormatterTest.php
tests/unit/framework/i18n/FormatterTest.php
+15
-0
No files found.
framework/i18n/Formatter.php
View file @
76ade0f6
...
...
@@ -1097,18 +1097,18 @@ class Formatter extends Component
$formatter
->
setAttribute
(
NumberFormatter
::
MIN_FRACTION_DIGITS
,
$decimals
);
}
foreach
(
$this
->
numberFormatterOptions
as
$name
=>
$value
)
{
$formatter
->
setAttribute
(
$name
,
$value
);
}
foreach
(
$options
as
$name
=>
$value
)
{
$formatter
->
setAttribute
(
$name
,
$value
);
}
foreach
(
$this
->
numberFormatterTextOptions
as
$name
=>
$attribute
)
{
$formatter
->
setTextAttribute
(
$name
,
$attribute
);
}
foreach
(
$textOptions
as
$name
=>
$attribute
)
{
$formatter
->
setTextAttribute
(
$name
,
$attribute
);
}
foreach
(
$this
->
numberFormatterOptions
as
$name
=>
$value
)
{
$formatter
->
setAttribute
(
$name
,
$value
);
}
foreach
(
$options
as
$name
=>
$value
)
{
$formatter
->
setAttribute
(
$name
,
$value
);
}
return
$formatter
;
}
}
tests/unit/framework/i18n/FormatterTest.php
View file @
76ade0f6
...
...
@@ -756,6 +756,21 @@ class FormatterTest extends TestCase
$this
->
assertSame
(
$this
->
formatter
->
nullDisplay
,
$this
->
formatter
->
asCurrency
(
null
));
}
/**
* https://github.com/yiisoft/yii2/pull/5261
*/
public
function
testIntlIssue5261
()
{
$this
->
formatter
->
locale
=
'en-US'
;
$this
->
formatter
->
numberFormatterOptions
=
[
\NumberFormatter
::
FRACTION_DIGITS
=>
0
];
$this
->
formatter
->
numberFormatterTextOptions
=
[
\NumberFormatter
::
CURRENCY_CODE
=>
'EUR'
];
$this
->
assertSame
(
'€100'
,
$this
->
formatter
->
asCurrency
(
100
,
'EUR'
));
}
public
function
testAsCurrency
()
{
$this
->
formatter
->
currencyCode
=
'USD'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment