Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / tests / Drupal / Tests / Core / DrupalKernel / DiscoverServiceProvidersTest.php
1 <?php
2
3 namespace Drupal\Tests\Core\DrupalKernel;
4
5 use Composer\Autoload\ClassLoader;
6 use Drupal\Core\DrupalKernel;
7 use Drupal\Core\Site\Settings;
8 use Drupal\Tests\UnitTestCase;
9
10 /**
11  * @coversDefaultClass \Drupal\Core\DrupalKernel
12  * @group DrupalKernel
13  */
14 class DiscoverServiceProvidersTest extends UnitTestCase {
15
16   /**
17    * Tests discovery with user defined container yaml.
18    *
19    * @covers ::discoverServiceProviders
20    */
21   public function testDiscoverServiceCustom() {
22     new Settings([
23       'container_yamls' => [
24         __DIR__ . '/fixtures/custom.yml',
25       ],
26     ]);
27
28     $kernel = new DrupalKernel('prod', new ClassLoader());
29     $kernel->discoverServiceProviders();
30
31     $expect = [
32       'app' => [
33         'core' => 'core/core.services.yml',
34       ],
35       'site' => [
36         __DIR__ . '/fixtures/custom.yml',
37       ],
38     ];
39
40     $this->assertAttributeSame($expect, 'serviceYamls', $kernel);
41   }
42
43   /**
44    * Tests the exception when container_yamls is not set.
45    */
46   public function testDiscoverServiceNoContainerYamls() {
47     new Settings([]);
48     $kernel = new DrupalKernel('prod', new ClassLoader());
49     $kernel->discoverServiceProviders();
50
51     $expect = [
52       'app' => [
53         'core' => 'core/core.services.yml',
54       ],
55       'site' => [],
56     ];
57     $this->assertAttributeSame($expect, 'serviceYamls', $kernel);
58   }
59
60 }