function ConfigImporterTest::testMissingCoreExtension

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

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