/** * Returns a Money object from native int amount and string currency code * * @param int $amount Amount expressed in the smallest units of $currency (e.g. cents) * @param string $currency Currency code of the money object * @return static */ public static function fromNative() { $args = func_get_args(); $amount = new Integer($args[0]); $currency = Currency::fromNative($args[1]); return new static($amount, $currency); }
public function testFromNative() { $fromNativeCurrency = Currency::fromNative('EUR'); $constructedCurrency = new Currency(CurrencyCode::EUR()); $this->assertTrue($fromNativeCurrency->sameValueAs($constructedCurrency)); }