DiscoverServiceProvidersTest.php in Zircon Profile 8
File
core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php
View source
<?php
namespace Drupal\Tests\Core\DrupalKernel;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Site\Settings;
use Drupal\Tests\UnitTestCase;
class DiscoverServiceProvidersTest extends UnitTestCase {
public function testDiscoverServiceCustom() {
new Settings(array(
'container_yamls' => array(
__DIR__ . '/fixtures/custom.yml',
),
));
$kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader());
$kernel
->discoverServiceProviders();
$expect = array(
'app' => array(
'core' => 'core/core.services.yml',
),
'site' => array(
__DIR__ . '/fixtures/custom.yml',
),
);
$this
->assertAttributeSame($expect, 'serviceYamls', $kernel);
}
public function testDiscoverServiceNoContainerYamls() {
new Settings([]);
$kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader());
$kernel
->discoverServiceProviders();
$expect = [
'app' => [
'core' => 'core/core.services.yml',
],
'site' => [],
];
$this
->assertAttributeSame($expect, 'serviceYamls', $kernel);
}
}