You are here

public function DiscoverServiceProvidersTest::testDiscoverServiceNoContainerYamls in Drupal 9

Same name and namespace in other branches
  1. 8 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 48

Class

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

Namespace

Drupal\Tests\Core\DrupalKernel

Code

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