You are here

public function ConfigIgnoreTest::testImportMissingConfig in Config Ignore 8.3

Tests config in active storage is not deleted if it should be ignored.

File

tests/src/Functional/ConfigIgnoreTest.php, line 168

Class

ConfigIgnoreTest
Test functionality of config_ignore module.

Namespace

Drupal\Tests\config_ignore\Functional

Code

public function testImportMissingConfig() {

  // Ignore a config entity.
  $this
    ->config('config_ignore.settings')
    ->set('ignored_config_entities', [
    'config_test.*',
  ])
    ->save();

  // Export the current state.
  $this
    ->doExport();

  /** @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $config_test_storage */
  $config_test_storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('config_test');

  /** @var \Drupal\config_test\ConfigTestInterface $entity */
  $entity = $config_test_storage
    ->create([
    'id' => 'foo',
    'label' => 'Foo',
  ]);
  $entity
    ->save();
  $this
    ->doImport();
  $loaded_entity = $config_test_storage
    ->load($entity
    ->id());
  $this
    ->assertInstanceOf(ConfigTestInterface::class, $loaded_entity);
}