You are here

public function ConfigImporterTest::testMissingCoreExtension in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testMissingCoreExtension()
  2. 9 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testMissingCoreExtension()

Tests missing core.extension during configuration import.

See also

\Drupal\Core\EventSubscriber\ConfigImportSubscriber

File

core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php, line 647

Class

ConfigImporterTest
Tests importing configuration from files into active configuration.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testMissingCoreExtension() {
  $sync = $this->container
    ->get('config.storage.sync');
  $sync
    ->delete('core.extension');
  $config_importer = $this
    ->configImporter();
  try {
    $config_importer
      ->import();
    $this
      ->fail('ConfigImporterException not thrown, invalid import was not stopped due to missing dependencies.');
  } catch (ConfigImporterException $e) {
    $expected = static::FAIL_MESSAGE . PHP_EOL . 'The core.extension configuration does not exist.';
    $this
      ->assertEquals($expected, $e
      ->getMessage());
    $error_log = $config_importer
      ->getErrors();
    $this
      ->assertEquals([
      'The core.extension configuration does not exist.',
    ], $error_log);
  }
}