function ConfigImporterTest::testDeleted in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/config/src/Tests/ConfigImporterTest.php \Drupal\config\Tests\ConfigImporterTest::testDeleted()
Tests deletion of configuration during import.
File
- core/
modules/ config/ src/ Tests/ ConfigImporterTest.php, line 122 - Contains \Drupal\config\Tests\ConfigImporterTest.
Class
- ConfigImporterTest
- Tests importing configuration from files into active configuration.
Namespace
Drupal\config\TestsCode
function testDeleted() {
$dynamic_name = 'config_test.dynamic.dotted.default';
$storage = $this->container
->get('config.storage');
$sync = $this->container
->get('config.storage.sync');
// Verify the default configuration values exist.
$config = $this
->config($dynamic_name);
$this
->assertIdentical($config
->get('id'), 'dotted.default');
// Delete the file from the sync directory.
$sync
->delete($dynamic_name);
// Import.
$this->configImporter
->reset()
->import();
// Verify the file has been removed.
$this
->assertIdentical($storage
->read($dynamic_name), FALSE);
$config = $this
->config($dynamic_name);
$this
->assertIdentical($config
->get('id'), NULL);
// Verify that appropriate module API hooks have been invoked.
$this
->assertTrue(isset($GLOBALS['hook_config_test']['load']));
$this
->assertFalse(isset($GLOBALS['hook_config_test']['presave']));
$this
->assertFalse(isset($GLOBALS['hook_config_test']['insert']));
$this
->assertFalse(isset($GLOBALS['hook_config_test']['update']));
$this
->assertTrue(isset($GLOBALS['hook_config_test']['predelete']));
$this
->assertTrue(isset($GLOBALS['hook_config_test']['delete']));
$this
->assertFalse($this->configImporter
->hasUnprocessedConfigurationChanges());
$logs = $this->configImporter
->getErrors();
$this
->assertEqual(count($logs), 0);
}