Issue #2150171 by alexpott, swentel: Confirm form of a simple setting always says it's creating a new configuration.
parent
21b80ceff0
commit
7db0d8b8d7
|
@ -207,7 +207,7 @@ class ConfigSingleImportForm extends ConfirmFormBase {
|
||||||
}
|
}
|
||||||
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 @@
|
||||||
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 @@ EOD;
|
||||||
$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.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue