コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function getCurrencyCode()
 {
     $availableCurrenciesCodes = $this->currencyProvider->getAvailableCurrenciesCodes();
     $currencyCode = $this->currencyProvider->getDefaultCurrencyCode();
     if (!in_array($currencyCode, $availableCurrenciesCodes, true)) {
         throw CurrencyNotFoundException::notAvailable($currencyCode, $availableCurrenciesCodes);
     }
     return $currencyCode;
 }
コード例 #2
0
 function it_throws_a_currency_not_found_exception_if_default_currency_is_not_available(CurrencyProviderInterface $currencyProvider)
 {
     $currencyProvider->getAvailableCurrenciesCodes()->willReturn(['GBP', 'PLN']);
     $currencyProvider->getDefaultCurrencyCode()->willReturn('EUR');
     $this->shouldThrow(CurrencyNotFoundException::class)->during('getCurrencyCode');
 }