Changing NumberHelper::currency() to format < 1euro based on the suggestions from 'Joel Haasnoot'. Instead of 99c you will get €0,99.

Test cases updated.  Fixes #1253
This commit is contained in:
mark_story 2010-11-02 21:56:24 -04:00
parent 2403d7fedc
commit d1403b0da8
2 changed files with 8 additions and 4 deletions

View file

@ -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 file

@ -236,7 +236,7 @@ class NumberHelperTest extends CakeTestCase {
$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 @@ class NumberHelperTest extends CakeTestCase {
$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 @@ class NumberHelperTest extends CakeTestCase {
$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 @@ class NumberHelperTest extends CakeTestCase {
$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);
}
/**