You are here

public function YamlFileLoaderTest::testLegacyLoadServices in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\YamlFileLoaderTest::testLegacyLoadServices()

@group legacy

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php, line 125

Class

YamlFileLoaderTest

Namespace

Symfony\Component\DependencyInjection\Tests\Loader

Code

public function testLegacyLoadServices() {
  $this
    ->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
  $container = new ContainerBuilder();
  $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml'));
  $loader
    ->load('legacy-services6.yml');
  $services = $container
    ->getDefinitions();
  $this
    ->assertEquals('FooClass', $services['constructor']
    ->getClass());
  $this
    ->assertEquals('getInstance', $services['constructor']
    ->getFactoryMethod());
  $this
    ->assertEquals('BazClass', $services['factory_service']
    ->getClass());
  $this
    ->assertEquals('baz_factory', $services['factory_service']
    ->getFactoryService());
  $this
    ->assertEquals('getInstance', $services['factory_service']
    ->getFactoryMethod());
  $this
    ->assertTrue($services['request']
    ->isSynthetic(), '->load() parses the synthetic flag');
  $this
    ->assertTrue($services['request']
    ->isSynchronized(), '->load() parses the synchronized flag');
  $this
    ->assertTrue($services['request']
    ->isLazy(), '->load() parses the lazy flag');
  $this
    ->assertNull($services['request']
    ->getDecoratedService());
}