You are here

public function ExporterTest::testDeleteConfigExport in Tome 8

@covers \Drupal\tome_sync\EventSubscriber\ConfigEventSubscriber::configDelete @covers \Drupal\tome_sync\EventSubscriber\LanguageConfigEventSubscriber::configDelete

File

modules/tome_sync/tests/src/Kernel/ExporterTest.php, line 130

Class

ExporterTest
Tests that the exporter works.

Namespace

Drupal\Tests\tome_sync\Kernel

Code

public function testDeleteConfigExport() {

  /** @var \Drupal\Core\Config\StorageInterface $storage */
  $storage = \Drupal::service('config.storage.sync');
  \Drupal::configFactory()
    ->getEditable('foo.bar')
    ->save();
  $this
    ->assertTrue($storage
    ->exists('foo.bar'));

  /** @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([
    'bonjour' => 'monde',
  ])
    ->save();
  $collection = $storage
    ->createCollection($override
    ->getStorage()
    ->getCollectionName());
  $this
    ->assertTrue($collection
    ->exists('foo.bar'));
  \Drupal::configFactory()
    ->getEditable('foo.bar')
    ->delete();
  $this
    ->assertFalse($storage
    ->exists('foo.bar'));
  $this
    ->assertFalse($collection
    ->exists('foo.bar'));
}