/** * {@inheritdoc} */ public function getFunctions() { return [new \Twig_SimpleFunction('rc_currency_convert', function ($twigOptions, $from, $to, $value, $provider = null) { return $this->converter->convert($from, $to, $value, $provider, false); }, ['needs_environment' => false, 'needs_context' => true])]; }
/** * @expectedException \RedCode\Currency\Rate\Exception\ProviderNotFoundException */ public function testCurrencyConverterBadProviderNotFoundException() { $badProvider = $this->getMock('\\RedCode\\Currency\\Rate\\Provider\\ICurrencyRateProvider'); $badProvider->method('getName')->willReturn($this->badProviderName); $factory = new ProviderFactory([$badProvider]); $currencyConverter = new CurrencyConverter($factory, $this->currencyRateManager, $this->currencyManager); $currencyConverter->convert('GBP', 'RUB', 1, $this->badProviderName); }