public function testShouldFormatMoneyWithNewConfig() { $money = new Money(1000.99); $config = new MoneyConfig(); $config->setDecimalPoint(','); $config->setThousandsSeparator('.'); $config->setMoneySimbol('R$'); $money->setConfig($config); $expected = 'R$ 1.000,99'; $result = "{$money}"; $this->assertEquals($expected, $result); }
/** * @expectedException InvalidArgumentException */ public function testShouldSetInvalidMoneySimbol() { $config = new MoneyConfig(); $config->setMoneySimbol(array(1)); }
public function __toString() { return $this->config->getMoneySymbol() . ' ' . number_format($this->value, 2, $this->config->getDecimalPoint(), $this->config->getThousandsSeparator()); }