/**
  * @covers ::saveConfiguration
  */
 public function testSaveConfiguration()
 {
     $configuration = array('currency_historical_rates' => TRUE, 'currency_fixed_rates' => TRUE, 'foo' => FALSE);
     $configuration_data = array(array('plugin_id' => 'currency_historical_rates', 'status' => TRUE), array('plugin_id' => 'currency_fixed_rates', 'status' => TRUE), array('plugin_id' => 'foo', 'status' => FALSE));
     $config = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->getMock();
     $config->expects($this->once())->method('set')->with('plugins', $configuration_data);
     $config->expects($this->once())->method('save');
     $this->configFactory->expects($this->once())->method('getEditable')->with('currency.exchange_rate_provider')->willReturn($config);
     $this->sut->saveConfiguration($configuration);
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $values = $form_state->getValues();
     uasort($values['exchange_rate_providers'], [SortArray::class, 'sortByWeightElement']);
     $configuration = array();
     foreach ($values['exchange_rate_providers'] as $plugin_id => $exchanger_configuration) {
         $configuration[$plugin_id] = (bool) $exchanger_configuration['enabled'];
     }
     $this->exchangeRateProvider->saveConfiguration($configuration);
     drupal_set_message($this->t('The configuration options have been saved.'));
 }