Skip to content
Snippets Groups Projects
Commit 1a9a28ef authored by Liam Morland's avatar Liam Morland
Browse files

Issue #3271312: Move example_setting to fillpdf_test.settings

parent 996dba12
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ function fillpdf_test_form_fillpdf_settings_alter(array &$form, FormStateInterfa ...@@ -20,7 +20,7 @@ function fillpdf_test_form_fillpdf_settings_alter(array &$form, FormStateInterfa
$form['example_setting'] = [ $form['example_setting'] = [
'#type' => 'textfield', '#type' => 'textfield',
'#title' => 'Form-altered example setting', '#title' => 'Form-altered example setting',
'#default_value' => \Drupal::config('fillpdf.settings')->get('example_setting'), '#default_value' => \Drupal::config('fillpdf_test.settings')->get('example_setting'),
'#states' => [ '#states' => [
'visible' => [ 'visible' => [
':input[name="backend"]' => ['value' => 'test'], ':input[name="backend"]' => ['value' => 'test'],
...@@ -53,7 +53,7 @@ function fillpdf_test_form_fillpdf_settings_submit($form, FormStateInterface $fo ...@@ -53,7 +53,7 @@ function fillpdf_test_form_fillpdf_settings_submit($form, FormStateInterface $fo
if ($form_state->getValue('backend') == 'test' && $value = $form_state->getValue('example_setting')) { if ($form_state->getValue('backend') == 'test' && $value = $form_state->getValue('example_setting')) {
/** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */ /** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */
$config_factory = \Drupal::service('config.factory'); $config_factory = \Drupal::service('config.factory');
$config_factory->getEditable('fillpdf.settings')->set('example_setting', $value)->save(); $config_factory->getEditable('fillpdf_test.settings')->set('example_setting', $value)->save();
} }
} }
......
...@@ -245,7 +245,8 @@ class FillPdfSettingsFormTest extends BrowserTestBase { ...@@ -245,7 +245,8 @@ class FillPdfSettingsFormTest extends BrowserTestBase {
// Therefore, the new values should be submitted, but *not* saved. // Therefore, the new values should be submitted, but *not* saved.
foreach ($edit as $field => $value) { foreach ($edit as $field => $value) {
$this->assertSession()->fieldValueEquals($field, $value); $this->assertSession()->fieldValueEquals($field, $value);
$this->assertEqual($this->config('fillpdf.settings')->get($field), NULL); $config_name = $field === 'example_setting' ? 'fillpdf_test.settings' : 'fillpdf.settings';
$this->assertEqual($this->config($config_name)->get($field), NULL);
} }
// Try again with a valid value. // Try again with a valid value.
...@@ -260,7 +261,8 @@ class FillPdfSettingsFormTest extends BrowserTestBase { ...@@ -260,7 +261,8 @@ class FillPdfSettingsFormTest extends BrowserTestBase {
$expected = ['fillpdf_service_api_key' => NULL] + $edit; $expected = ['fillpdf_service_api_key' => NULL] + $edit;
foreach ($expected as $field => $value) { foreach ($expected as $field => $value) {
$this->assertSession()->fieldValueEquals($field, $value); $this->assertSession()->fieldValueEquals($field, $value);
$this->assertEqual($this->config('fillpdf.settings')->get($field), $value); $config_name = $field === 'example_setting' ? 'fillpdf_test.settings' : 'fillpdf.settings';
$this->assertEqual($this->config($config_name)->get($field), $value);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment