Skip to content
Snippets Groups Projects
Commit 7db0d8b8 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2150171 by alexpott, swentel: Confirm form of a simple setting always...

Issue #2150171 by alexpott, swentel: Confirm form of a simple setting always says it's creating a new configuration.
parent 21b80cef
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -207,7 +207,7 @@ public function validateForm(array &$form, array &$form_state) { ...@@ -207,7 +207,7 @@ public function validateForm(array &$form, array &$form_state) {
} }
else { else {
$config = $this->config($form_state['values']['config_name']); $config = $this->config($form_state['values']['config_name']);
$this->configExists = $config->isNew() ? $config : FALSE; $this->configExists = !$config->isNew() ? $config : FALSE;
} }
// Store the decoded version of the submitted import. // Store the decoded version of the submitted import.
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\config\Tests; namespace Drupal\config\Tests;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
use Symfony\Component\Yaml\Yaml;
/** /**
* Tests the user interface for importing/exporting a single configuration. * Tests the user interface for importing/exporting a single configuration.
...@@ -97,6 +98,25 @@ public function testImport() { ...@@ -97,6 +98,25 @@ public function testImport() {
$this->assertIdentical($entity->uuid(), $second_uuid); $this->assertIdentical($entity->uuid(), $second_uuid);
} }
/**
* Tests importing a simple configuration file.
*/
public function testImportSimpleConfiguration() {
$this->drupalLogin($this->drupalCreateUser(array('import configuration')));
$yaml = new Yaml();
$config = \Drupal::config('system.site')->set('name', 'Test simple import');
$edit = array(
'config_type' => 'system.simple',
'config_name' => $config->getName(),
'import' => $yaml->dump($config->get()),
);
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import'));
$this->assertRaw(t('Are you sure you want to update the %name @type?', array('%name' => $config->getName(), '@type' => 'simple configuration')));
$this->drupalPostForm(NULL, array(), t('Confirm'));
$this->drupalGet('/');
$this->assertText('Test simple import');
}
/** /**
* Tests exporting a single configuration file. * Tests exporting a single configuration file.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment