function ConfigImporterTest::testMissingCoreExtension

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testMissingCoreExtension()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testMissingCoreExtension()
  3. 10 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 651

Class

ConfigImporterTest
Tests importing configuration from files into active configuration.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testMissingCoreExtension() : void {
    $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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.