Tests creation of configuration during import.
function testNew() {
$dynamic_name = 'config_test.dynamic.new';
$storage = $this->container
->get('config.storage');
$staging = $this->container
->get('config.storage.staging');
// Verify the configuration to create does not exist yet.
$this
->assertIdentical($storage
->exists($dynamic_name), FALSE, $dynamic_name . ' not found.');
// Create new config entity.
$original_dynamic_data = array(
'id' => 'new',
'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651',
'label' => 'New',
'weight' => '0',
'style' => '',
'status' => '1',
'langcode' => language_default()->langcode,
'protected_property' => '',
);
$staging
->write($dynamic_name, $original_dynamic_data);
$this
->assertIdentical($staging
->exists($dynamic_name), TRUE, $dynamic_name . ' found.');
// Import.
$this->configImporter
->reset()
->import();
// Verify the values appeared.
$config = config($dynamic_name);
$this
->assertIdentical($config
->get('label'), $original_dynamic_data['label']);
// Verify that appropriate module API hooks have been invoked.
$this
->assertFalse(isset($GLOBALS['hook_config_test']['load']));
$this
->assertTrue(isset($GLOBALS['hook_config_test']['presave']));
$this
->assertTrue(isset($GLOBALS['hook_config_test']['insert']));
$this
->assertFalse(isset($GLOBALS['hook_config_test']['update']));
$this
->assertFalse(isset($GLOBALS['hook_config_test']['predelete']));
$this
->assertFalse(isset($GLOBALS['hook_config_test']['delete']));
// Verify that there is nothing more to import.
$this
->assertFalse($this->configImporter
->hasUnprocessedChanges());
}