Skip to content

Commit

Permalink
Changing NumberHelper::currency() to format < 1euro based on the sugg…
Browse files Browse the repository at this point in the history
…estions from 'Joel Haasnoot'. Instead of 99c you will get €0,99.

Test cases updated.  Fixes #1253
  • Loading branch information
markstory committed Nov 3, 2010
1 parent 2403d7f commit d1403b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cake/libs/view/helpers/number.php
Expand Up @@ -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
)
);
Expand Down
10 changes: 7 additions & 3 deletions cake/tests/cases/libs/view/helpers/number.test.php
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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'=>'-'));
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit d1403b0

Please sign in to comment.