コード例 #1
0
 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);
 }
コード例 #2
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testShouldSetInvalidMoneySimbol()
 {
     $config = new MoneyConfig();
     $config->setMoneySimbol(array(1));
 }
コード例 #3
0
ファイル: Money.php プロジェクト: asanoturna/SimpleFinance
 public function __toString()
 {
     return $this->config->getMoneySymbol() . ' ' . number_format($this->value, 2, $this->config->getDecimalPoint(), $this->config->getThousandsSeparator());
 }