Commit 7db0d8b8 authored by webchick's avatar webchick

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
......@@ -207,7 +207,7 @@ public function validateForm(array &$form, array &$form_state) {
}
else {
$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.
......
......@@ -8,6 +8,7 @@
namespace Drupal\config\Tests;
use Drupal\simpletest\WebTestBase;
use Symfony\Component\Yaml\Yaml;
/**
* Tests the user interface for importing/exporting a single configuration.
......@@ -97,6 +98,25 @@ public function testImport() {
$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.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment