function ImportStorageTransformerTest::testTransform
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php \Drupal\KernelTests\Core\Config\ImportStorageTransformerTest::testTransform()
- 10 core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php \Drupal\KernelTests\Core\Config\ImportStorageTransformerTest::testTransform()
- 11.x core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php \Drupal\KernelTests\Core\Config\ImportStorageTransformerTest::testTransform()
Test the import transformation.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Config/ ImportStorageTransformerTest.php, line 38
Class
- ImportStorageTransformerTest
- Tests the import storage transformer.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testTransform() {
// Get the raw system.site config and set it in the sync storage.
$rawConfig = $this->config('system.site')
->getRawData();
$storage = new MemoryStorage();
$this->copyConfig($this->container
->get('config.storage'), $storage);
$import = $this->container
->get('config.import_transformer')
->transform($storage);
$config = $import->read('system.site');
// The test subscriber always adds "Arrr" to the current site name.
$this->assertEquals($rawConfig['name'] . ' Arrr', $config['name']);
$this->assertEquals($rawConfig['slogan'], $config['slogan']);
// Update the site config in the storage to test a second transformation.
$config['name'] = 'New name';
$config['slogan'] = 'New slogan';
$storage->write('system.site', $config);
$import = $this->container
->get('config.import_transformer')
->transform($storage);
$config = $import->read('system.site');
// The test subscriber always adds "Arrr" to the current site name.
$this->assertEquals($rawConfig['name'] . ' Arrr', $config['name']);
$this->assertEquals('New slogan', $config['slogan']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.