function AmountTest::testGetCurrencyWithFixedCurrency in Currency 8.3
@covers ::getCurrency
File
- tests/
src/ Unit/ Plugin/ views/ field/ AmountTest.php, line 288
Class
- AmountTest
- @coversDefaultClass \Drupal\currency\Plugin\views\field\Amount
Namespace
Drupal\Tests\currency\Unit\Plugin\views\fieldCode
function testGetCurrencyWithFixedCurrency() {
$currency_code = $this
->randomMachineName();
$currency = $this
->createMock(CurrencyInterface::class);
$map = [
[
$currency_code,
$currency,
],
];
$this->currencyStorage
->expects($this
->atLeastOnce())
->method('load')
->willReturnMap($map);
$result_row = new ResultRow();
$configuration = [];
$plugin_id = $this
->randomMachineName();
$this->pluginDefinition['currency_code'] = $currency_code;
$this->sut = new Amount($configuration, $plugin_id, $this->pluginDefinition, $this->stringTranslation, $this->moduleHandler, $this->renderer, $this->currencyStorage);
$this->sut
->init($this->viewsViewExecutable, $this->viewsDisplayHandler);
$method = new \ReflectionMethod($this->sut, 'getCurrency');
$method
->setAccessible(TRUE);
$this
->assertSame($currency, $method
->invoke($this->sut, $result_row));
}