Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changing NumberHelper::currency() to format < 1euro based on the sugg…

…estions from 'Joel Haasnoot'. Instead of 99c you will get €0,99.

Test cases updated.  Fixes #1253
  • Loading branch information...
commit d1403b0da8b0e2f1b4efad510e2891a0e4c50928 1 parent 2403d7f
@markstory markstory authored
View
2  cake/libs/view/helpers/number.php
@@ -48,7 +48,7 @@ class NumberHelper extends AppHelper {
'decimals' => '.', 'negative' => '()','escape' => false
),
'EUR' => array(
- 'before'=>'&#8364;', 'after' => 'c', 'zero' => 0, 'places' => 2, 'thousands' => '.',
+ 'before'=>'&#8364;', 'after' => false, 'zero' => 0, 'places' => 2, 'thousands' => '.',
'decimals' => ',', 'negative' => '()', 'escape' => false
)
);
View
10 cake/tests/cases/libs/view/helpers/number.test.php
@@ -236,7 +236,7 @@ function testCurrencyCentsPositive() {
$this->assertEqual($expected, $result);
$result = $this->Number->currency($value, 'EUR');
- $expected = '99c';
+ $expected = '&#8364;0,99';
$this->assertEqual($expected, $result);
$result = $this->Number->currency($value, 'GBP');
@@ -258,7 +258,7 @@ function testCurrencyCentsNegative() {
$this->assertEqual($expected, $result);
$result = $this->Number->currency($value, 'EUR');
- $expected = '(99c)';
+ $expected = '(&#8364;0,99)';
$this->assertEqual($expected, $result);
$result = $this->Number->currency($value, 'GBP');
@@ -270,7 +270,7 @@ function testCurrencyCentsNegative() {
$this->assertEqual($expected, $result);
$result = $this->Number->currency($value, 'EUR', array('negative'=>'-'));
- $expected = '-99c';
+ $expected = '-&#8364;0,99';
$this->assertEqual($expected, $result);
$result = $this->Number->currency($value, 'GBP', array('negative'=>'-'));
@@ -336,6 +336,10 @@ function testCurrencyOptions() {
$result = $this->Number->currency('0.35', 'GBP');
$expected = '35p';
$this->assertEqual($expected, $result);
+
+ $result = $this->Number->currency('0.35', 'EUR');
+ $expected = '&#8364;0,35';
+ $this->assertEqual($expected, $result);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.