Issue #2150171 by alexpott, swentel: Confirm form of a simple setting always says it's creating a new configuration.

8.0.x
webchick 2013-12-09 21:44:43 -08:00
parent 21b80ceff0
commit 7db0d8b8d7
2 changed files with 21 additions and 1 deletions

View File

@ -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.

View File

@ -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.
*/