コード例 #1
0
 /**
  *
  */
 public function testConvert()
 {
     $service = $this->makeMockService();
     $from = \Superbalist\Money\CurrencyFactory::make('ZAR');
     $to = \Superbalist\Money\CurrencyFactory::make('USD');
     $actual = $service->convert('1', $from, $to);
     $this->assertSame('0.082776', $actual);
 }
コード例 #2
0
 /**
  *
  */
 public function testToString()
 {
     $currency = \Superbalist\Money\CurrencyFactory::make('ZAR');
     $str = (string) $currency;
     $this->assertSame('ZAR', $str);
 }
コード例 #3
0
ファイル: MoneyTests.php プロジェクト: superbalist/php-money
 /**
  *
  */
 public function testDisplay()
 {
     $currency = \Superbalist\Money\CurrencyFactory::make('ZAR');
     $money = new \Superbalist\Money\Money('150.36', $currency);
     $actual = $money->display();
     $this->assertSame('R150.36', $actual);
     $currency = \Superbalist\Money\CurrencyFactory::make('USD');
     $money = new \Superbalist\Money\Money('150.36', $currency);
     $actual = $money->display(0);
     $this->assertSame('$150', $actual);
     $currency = \Superbalist\Money\CurrencyFactory::make('ZAR');
     $money = new \Superbalist\Money\Money('-53.87', $currency);
     $actual = $money->display();
     $this->assertSame('-R53.87', $actual);
 }