function DefaultConfigTest::testConfigIsEmpty

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php \Drupal\Tests\Core\Extension\DefaultConfigTest::testConfigIsEmpty()
  2. 8.9.x core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php \Drupal\Tests\Core\Extension\DefaultConfigTest::testConfigIsEmpty()
  3. 10 core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php \Drupal\Tests\Core\Extension\DefaultConfigTest::testConfigIsEmpty()

Tests that core.extension.yml is empty by default.

The default configuration MUST NOT specify any extensions, because every extension has to be installed in a regular way.

Otherwise, the regular runtime application would operate with extensions that were never installed. The default configuration of such extensions would not exist. Installation hooks would never be executed.

File

core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php, line 27

Class

DefaultConfigTest
Tests default configuration of the Extension system.

Namespace

Drupal\Tests\Core\Extension

Code

public function testConfigIsEmpty() : void {
    $config = Yaml::parse(file_get_contents($this->root . '/core/config/install/core.extension.yml'));
    $expected = [
        'module' => [],
        'theme' => [],
        'profile' => NULL,
    ];
    $this->assertEquals($expected, $config);
}

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