public function ExporterTest::testExportConfig in Tome 8
@covers \Drupal\tome_sync\EventSubscriber\ConfigEventSubscriber::configSave @covers \Drupal\tome_sync\EventSubscriber\LanguageConfigEventSubscriber::configSave
File
- modules/
tome_sync/ tests/ src/ Kernel/ ExporterTest.php, line 153
Class
- ExporterTest
- Tests that the exporter works.
Namespace
Drupal\Tests\tome_sync\KernelCode
public function testExportConfig() {
/** @var \Drupal\Core\Config\StorageInterface $storage */
$storage = \Drupal::service('config.storage.sync');
$data = [
'hello' => 'world',
];
\Drupal::configFactory()
->getEditable('foo.bar')
->setData($data)
->save();
$this
->assertEquals($data, $storage
->read('foo.bar'));
$data = [
'bonjour' => 'monde',
];
/** @var \Drupal\language\Config\LanguageConfigFactoryOverrideInterface $config_factory_override */
$config_factory_override = \Drupal::service('language.config_factory_override');
$override = $config_factory_override
->getOverride('fr', 'foo.bar');
$override
->setData($data)
->save();
$collection = $storage
->createCollection($override
->getStorage()
->getCollectionName());
$this
->assertEquals($data, $collection
->read('foo.bar'));
}