mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
2403d7fedc
commit
d1403b0da8
2 changed files with 8 additions and 4 deletions
|
@ -48,7 +48,7 @@ class NumberHelper extends AppHelper {
|
|||
'decimals' => '.', 'negative' => '()','escape' => false
|
||||
),
|
||||
'EUR' => array(
|
||||
'before'=>'€', 'after' => 'c', 'zero' => 0, 'places' => 2, 'thousands' => '.',
|
||||
'before'=>'€', 'after' => false, 'zero' => 0, 'places' => 2, 'thousands' => '.',
|
||||
'decimals' => ',', 'negative' => '()', 'escape' => false
|
||||
)
|
||||
);
|
||||
|
|
|
@ -236,7 +236,7 @@ class NumberHelperTest extends CakeTestCase {
|
|||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->Number->currency($value, 'EUR');
|
||||
$expected = '99c';
|
||||
$expected = '€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 = '(€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 = '-€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 = '€0,35';
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue