function DiscoverServiceProvidersTest::testDiscoverServiceNoContainerYamls

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php \Drupal\Tests\Core\DrupalKernel\DiscoverServiceProvidersTest::testDiscoverServiceNoContainerYamls()
  2. 8.9.x core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php \Drupal\Tests\Core\DrupalKernel\DiscoverServiceProvidersTest::testDiscoverServiceNoContainerYamls()
  3. 10 core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php \Drupal\Tests\Core\DrupalKernel\DiscoverServiceProvidersTest::testDiscoverServiceNoContainerYamls()

Tests the exception when container_yamls is not set.

File

core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php, line 49

Class

DiscoverServiceProvidersTest
@coversDefaultClass \Drupal\Core\DrupalKernel @group DrupalKernel

Namespace

Drupal\Tests\Core\DrupalKernel

Code

public function testDiscoverServiceNoContainerYamls() : void {
    new Settings([]);
    $kernel = new DrupalKernel('prod', new ClassLoader());
    $kernel->discoverServiceProviders();
    $reflected_yamls = (new \ReflectionObject($kernel))->getProperty('serviceYamls');
    $expect = [
        'app' => [
            'core' => 'core/core.services.yml',
        ],
        'site' => [],
    ];
    $this->assertSame($expect, $reflected_yamls->getValue($kernel));
}

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