Permalink
Browse files

Test case and Fix for: Number::currency() issue for custom formats an…

  • Loading branch information...
1 parent f867f0c commit 38eb2140066d618ebfd4a25a66002288372f2cd6 @wnasich wnasich committed Jan 19, 2012
Showing with 6 additions and 1 deletion.
  1. +1 −1 cake/libs/view/helpers/number.php
  2. +5 −0 cake/tests/cases/libs/view/helpers/number.test.php
@@ -60,7 +60,7 @@ class NumberHelper extends AppHelper {
* @access protected
*/
var $_currencyDefaults = array(
- 'before'=>'', 'after' => '', 'zero' => '0', 'places' => 2, 'thousands' => ',',
+ 'before'=>'', 'after' => false, 'zero' => '0', 'places' => 2, 'thousands' => ',',
'decimals' => '.','negative' => '()', 'escape' => true
);
@@ -151,6 +151,11 @@ function testCurrencyAddFormat() {
$result = $this->Number->currency(-10, 'Other');
$expected = '($$ 10.00)';
$this->assertEqual($expected,$result);
+
+ $this->Number->addFormat('Other2', array('before' => '$ '));
+ $result = $this->Number->currency(0.22, 'Other2');
+ $expected = '$ 0.22';
+ $this->assertEqual($expected,$result);
}
/**

0 comments on commit 38eb214

Please sign in to comment.