You are here

private function YamlDefinitionsLoader::loadDefinitionsFromServicesYaml in Hook Event Dispatcher 8

Load the definitions from the services YAML.

1 call to YamlDefinitionsLoader::loadDefinitionsFromServicesYaml()
YamlDefinitionsLoader::__construct in tests/src/Unit/Preprocess/Helpers/YamlDefinitionsLoader.php
YamlDefinitionsLoader constructor.

File

tests/src/Unit/Preprocess/Helpers/YamlDefinitionsLoader.php, line 55

Class

YamlDefinitionsLoader
Class YamlDefinitionsLoader.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Preprocess\Helpers

Code

private function loadDefinitionsFromServicesYaml() {
  $yaml = new Parser();
  $content = file_get_contents(dirname(dirname(dirname(dirname(dirname(__DIR__))))) . '/hook_event_dispatcher.services.yml');
  $services = $yaml
    ->parse($content)['services'];

  // Remove the Manager.
  unset($services['hook_event_dispatcher.manager']);
  $factories = $this->services = $services;

  // Remove the Service and Factory Mapper.
  unset($factories['preprocess_event.service'], $factories['preprocess_event.factory_mapper']);
  $this->factories = $factories;
}