public function PluginBasedExchangeRateProviderTest::testLoadConfiguration in Currency 8.3
@covers ::loadConfiguration
File
- tests/
src/ Unit/ PluginBasedExchangeRateProviderTest.php, line 56
Class
- PluginBasedExchangeRateProviderTest
- @coversDefaultClass \Drupal\currency\PluginBasedExchangeRateProvider
Namespace
Drupal\Tests\currency\UnitCode
public function testLoadConfiguration() {
$plugin_id_a = $this
->randomMachineName();
$plugin_id_b = $this
->randomMachineName();
$plugin_definitions = array(
$plugin_id_a => array(),
$plugin_id_b => array(),
);
$config_value = array(
array(
'plugin_id' => $plugin_id_b,
'status' => TRUE,
),
);
$this->currencyExchangeRateProviderManager
->expects($this
->once())
->method('getDefinitions')
->willReturn($plugin_definitions);
$config = $this
->getMockBuilder(Config::class)
->disableOriginalConstructor()
->getMock();
$config
->expects($this
->once())
->method('get')
->with('plugins')
->willReturn($config_value);
$this->configFactory
->expects($this
->once())
->method('get')
->with('currency.exchange_rate_provider')
->willReturn($config);
$configuration = $this->sut
->loadConfiguration();
$expected = array(
$plugin_id_b => TRUE,
$plugin_id_a => FALSE,
);
$this
->assertSame($expected, $configuration);
}