You are here

public function ConfigImporterTest::testMissingCoreExtension in Drupal 8

Same name and namespace in other branches
  1. 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 675

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');
  try {
    $this->configImporter
      ->reset()
      ->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 = $this->configImporter
      ->getErrors();
    $this
      ->assertEqual([
      'The core.extension configuration does not exist.',
    ], $error_log);
  }
}