/** * */ 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); }
/** * */ public function testToString() { $currency = \Superbalist\Money\CurrencyFactory::make('ZAR'); $str = (string) $currency; $this->assertSame('ZAR', $str); }
/** * */ 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); }