public function testGetAvailableCurrencies() { $providerChain = $this->createCurrencyProviderChain(); // Add a different GBP instance, that comes after the first one. // The first instance available in the chain takes precedence. $provider = new ConfigurableCurrencyProvider(); $provider->addCurrency(Currency::create('GBP', 999, 'A competing GBP instance', 6)); $providerChain->addCurrencyProvider($provider); $isoCurrencyProvider = ISOCurrencyProvider::getInstance(); $this->assertCurrencyProviderContains(['EUR' => $isoCurrencyProvider->getCurrency('EUR'), 'GBP' => $isoCurrencyProvider->getCurrency('GBP'), 'USD' => $isoCurrencyProvider->getCurrency('USD'), 'CAD' => $isoCurrencyProvider->getCurrency('CAD')], $providerChain); }
/** * @depends testRemoveCurrency * @expectedException \Brick\Money\Exception\UnknownCurrencyException * * @param ConfigurableCurrencyProvider $provider */ public function testGetUnknownCurrency(ConfigurableCurrencyProvider $provider) { $provider->getCurrency('XXX'); }
/** * Removes a currency from the default currency provider. * * If the currency is not registered, or is an ISO currency, this method does nothing. * * @param Currency $currency The currency to remove. * * @return DefaultCurrencyProvider This instance, for chaining. */ public function removeCurrency(Currency $currency) { $this->configurableCurrencyProvider->removeCurrency($currency); return $this; }