Example #1
0
 public function testFormat()
 {
     $oneCent = new Money(1, $this->mathProvider);
     $oneDollar = new Money(100, $this->mathProvider);
     $oneBillionDollars = new Money('100000000000', $this->mathProvider);
     $this->assertSame('0.01', $oneCent->format());
     $this->assertSame('1.00', $oneDollar->format());
     $this->assertSame('1,000,000,000.00', $oneBillionDollars->format());
     // alternate separators
     $this->assertSame('1-000-000-000_00', $oneBillionDollars->format('-', 2, '_'));
     // true,false doesn't matter for these
     $this->assertSame('1', $oneCent->format(',', 0));
     $this->assertSame('10.0', $oneDollar->format(',', 1));
 }