Security update for Core, with self-updated composer
[yaffs-website] / web / core / tests / Drupal / Tests / Core / DependencyInjection / YamlFileLoaderTest.php
1 <?php
2
3 namespace Drupal\Tests\Core\DependencyInjection;
4
5 use Drupal\Component\FileCache\FileCacheFactory;
6 use Drupal\Core\DependencyInjection\ContainerBuilder;
7 use Drupal\Core\DependencyInjection\YamlFileLoader;
8 use Drupal\Tests\UnitTestCase;
9 use org\bovigo\vfs\vfsStream;
10
11 /**
12  * @coversDefaultClass \Drupal\Core\DependencyInjection\YamlFileLoader
13  * @group DependencyInjection
14  */
15 class YamlFileLoaderTest extends UnitTestCase {
16
17   /**
18    * {@inheritdoc}
19    */
20   protected function setUp() {
21     parent::setUp();
22
23     FileCacheFactory::setPrefix('example');
24   }
25
26   public function testParseDefinitionsWithProvider() {
27     $yml = <<<YAML
28 services:
29   example_service:
30     class: \Drupal\Core\ExampleClass
31 YAML;
32
33     vfsStream::setup('drupal', NULL, [
34       'modules/example/example.yml' => $yml,
35     ]);
36
37     $builder = new ContainerBuilder();
38     $yaml_file_loader = new YamlFileLoader($builder);
39     $yaml_file_loader->load('vfs://drupal/modules/example/example.yml');
40
41     $this->assertEquals(['_provider' => [['provider' => 'example']]], $builder->getDefinition('example_service')->getTags());
42   }
43
44 }