Commit 47e3fabd authored by Thorsten Buss's avatar Thorsten Buss

FIX: return string-float, cause float is locale-depended (in de 1,55 instead of 1.55)

parent 1f41e388
......@@ -91,7 +91,7 @@ or execute
// int 123456
$m->amount();
// float 1234.56
// string "1234.56"
$m->normalize();
// 1234,56€
......
......@@ -70,10 +70,10 @@ class Money implements \JsonSerializable, Jsonable, Arrayable {
/**
* amount as decimal with . as decPoint
* @return float
* @return string
*/
public function normalize() {
return (float)bcdiv($this->amount(), $this->currency->unit_factor, $this->currency->decimal_place);
return bcdiv($this->amount(), $this->currency->unit_factor, $this->currency->decimal_place);
}
/**
......
......@@ -58,7 +58,7 @@ class MoneyTest extends \PHPUnit_Framework_TestCase {
$m = $this->money($amount, $this->currency());
$this->assertEquals($amount, $m->amount(), 'Amount');
$this->assertEquals($amount, $m->value(), 'Amount');
$this->assertEquals(1234.56, $m->normalize(), 'Normalize');
$this->assertEquals("1234.56", $m->normalize(), 'Normalize');
$this->assertEquals('1234,56€', $m->format(), 'default Format');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment