3 namespace Drupal\Tests\Core\DrupalKernel;
5 use Composer\Autoload\ClassLoader;
6 use Drupal\Core\DrupalKernel;
7 use Drupal\Core\Site\Settings;
8 use Drupal\Tests\UnitTestCase;
11 * @coversDefaultClass \Drupal\Core\DrupalKernel
14 class DiscoverServiceProvidersTest extends UnitTestCase {
17 * Tests discovery with user defined container yaml.
19 * @covers ::discoverServiceProviders
21 public function testDiscoverServiceCustom() {
23 'container_yamls' => [
24 __DIR__ . '/fixtures/custom.yml'
28 $kernel = new DrupalKernel('prod', new ClassLoader());
29 $kernel->discoverServiceProviders();
33 'core' => 'core/core.services.yml',
36 __DIR__ . '/fixtures/custom.yml',
40 $this->assertAttributeSame($expect, 'serviceYamls', $kernel);
44 * Tests the exception when container_yamls is not set.
46 public function testDiscoverServiceNoContainerYamls() {
48 $kernel = new DrupalKernel('prod', new ClassLoader());
49 $kernel->discoverServiceProviders();
53 'core' => 'core/core.services.yml',
57 $this->assertAttributeSame($expect, 'serviceYamls', $kernel);