function YamlFileLoaderTest::testParseDefinitionsWithProvider
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php \Drupal\Tests\Core\DependencyInjection\YamlFileLoaderTest::testParseDefinitionsWithProvider()
- 10 core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php \Drupal\Tests\Core\DependencyInjection\YamlFileLoaderTest::testParseDefinitionsWithProvider()
- 11.x core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php \Drupal\Tests\Core\DependencyInjection\YamlFileLoaderTest::testParseDefinitionsWithProvider()
File
-
core/
tests/ Drupal/ Tests/ Core/ DependencyInjection/ YamlFileLoaderTest.php, line 26
Class
- YamlFileLoaderTest
- @coversDefaultClass \Drupal\Core\DependencyInjection\YamlFileLoader @group DependencyInjection
Namespace
Drupal\Tests\Core\DependencyInjectionCode
public function testParseDefinitionsWithProvider() {
$yml = <<<YAML
services:
example_service:
class: \\Drupal\\Core\\ExampleClass
example_private_service:
class: \\Drupal\\Core\\ExampleClass
public: false
YAML;
vfsStream::setup('drupal', NULL, [
'modules' => [
'example' => [
'example.yml' => $yml,
],
],
]);
$builder = new ContainerBuilder();
$yaml_file_loader = new YamlFileLoader($builder);
$yaml_file_loader->load('vfs://drupal/modules/example/example.yml');
$this->assertEquals([
'_provider' => [
[
'provider' => 'example',
],
],
], $builder->getDefinition('example_service')
->getTags());
$this->assertTrue($builder->getDefinition('example_service')
->isPublic());
$this->assertFalse($builder->getDefinition('example_private_service')
->isPublic());
$builder->compile();
$this->assertTrue($builder->has('example_service'));
$this->assertFalse($builder->has('example_private_service'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.