Ejemplo n.º 1
0
 public function testFormat()
 {
     $m1 = Money::usd(123456);
     // $1234.56
     $m2 = Money::usd(123400);
     // $1234.00
     $this->assertEquals('$1,234.56', $m1->format());
     $this->assertEquals('$1,234~56', $m1->format(array('decimal_mark' => '~')));
     $this->assertEquals('$1_234.56', $m1->format(array('thousands_separator' => '_')));
     $this->assertEquals('$1,234.56 USD', $m1->format(array('with_currency' => true)));
     $this->assertEquals('<span class="symbol">$</span><span class="amount">1,234.56</span><span class="currency">USD</span>', $m1->format(array('with_currency' => true, 'html' => true)));
     $this->assertEquals('$1,234', $m1->format(array('no_cents' => true)));
     $this->assertEquals('$1,234.56', $m1->format(array('no_cents_if_whole' => true)));
     $this->assertEquals('$1,234', $m2->format(array('no_cents_if_whole' => true)));
     $this->assertEquals('$1,234.56', $m1->format(array('no_cents_if_whole' => false)));
     $this->assertEquals('$1,234.00', $m2->format(array('no_cents_if_whole' => false)));
     $this->assertEquals('1,234.56$', $m1->format(array('symbol_position' => 'after')));
 }
Ejemplo n.º 2
0
<?php

require_once 'src/money.php';
use Money\Money;
$m = Money::usd(100);
print_r($m->format(array('disambiguate' => true)));