DefaultConfigTest.php

Same filename in this branch
  1. 10 core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
Same filename in other branches
  1. 9 core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
  2. 9 core/tests/Drupal/KernelTests/Core/Config/DefaultConfigTest.php
  3. 9 core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php
  4. 8.9.x core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
  5. 8.9.x core/tests/Drupal/KernelTests/Core/Config/DefaultConfigTest.php
  6. 8.9.x core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php
  7. 11.x core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
  8. 11.x core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php

Namespace

Drupal\Tests\Core\Extension

File

core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\Core\Extension;

use Drupal\Tests\UnitTestCase;
use Symfony\Component\Yaml\Yaml;

/**
 * Tests default configuration of the Extension system.
 *
 * @group Extension
 */
class DefaultConfigTest extends UnitTestCase {
    
    /**
     * 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.
     */
    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);
    }

}

Classes

Title Deprecated Summary
DefaultConfigTest Tests default configuration of the Extension system.

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