diff --git a/core/modules/config/lib/Drupal/config/Form/ConfigSingleImportForm.php b/core/modules/config/lib/Drupal/config/Form/ConfigSingleImportForm.php index 91a8e286fc4..89f71be8c12 100644 --- a/core/modules/config/lib/Drupal/config/Form/ConfigSingleImportForm.php +++ b/core/modules/config/lib/Drupal/config/Form/ConfigSingleImportForm.php @@ -207,7 +207,7 @@ class ConfigSingleImportForm extends ConfirmFormBase { } 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. diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigSingleImportExportTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigSingleImportExportTest.php index 6d610a06629..564218a00a1 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigSingleImportExportTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigSingleImportExportTest.php @@ -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 @@ EOD; $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. */