You are here

function PluginBasedExchangeRateProviderFormWebTest::testCurrencyExchangerUI in Currency 8.3

Same name in this branch
  1. 8.3 tests/src/Functional/Controller/PluginBasedExchangeRateProviderFormWebTest.php \Drupal\Tests\currency\Functional\Controller\PluginBasedExchangeRateProviderFormWebTest::testCurrencyExchangerUI()
  2. 8.3 tests/src/Functional/Form/PluginBasedExchangeRateProviderFormWebTest.php \Drupal\Tests\currency\Functional\Form\PluginBasedExchangeRateProviderFormWebTest::testCurrencyExchangerUI()

Test CurrencyExchanger's UI.

File

tests/src/Functional/Controller/PluginBasedExchangeRateProviderFormWebTest.php, line 24

Class

PluginBasedExchangeRateProviderFormWebTest
\Drupal\currency\Form\PluginBasedExchangeRateProviderForm web test.

Namespace

Drupal\Tests\currency\Functional\Controller

Code

function testCurrencyExchangerUI() {
  $exchange_delegator = \Drupal::service('currency.exchange_rate_provider');
  $user = $this
    ->drupalCreateUser(array(
    'currency.exchange_rate_provider.administer',
  ));
  $this
    ->drupalLogin($user);

  // Test the default configuration.
  $this
    ->assertEqual(array(
    'currency_fixed_rates' => TRUE,
    'currency_historical_rates' => TRUE,
  ), $exchange_delegator
    ->loadConfiguration());

  // Test overridden configuration.
  $path = 'admin/config/regional/currency-exchange';
  $values = array(
    'exchange_rate_providers[currency_fixed_rates][enabled]' => FALSE,
  );
  $this
    ->drupalPostForm($path, $values, t('Save'));
  $this
    ->assertEqual(array(
    'currency_fixed_rates' => FALSE,
    'currency_historical_rates' => TRUE,
  ), $exchange_delegator
    ->loadConfiguration());
}