You are here

public function YamlFileLoaderTest::testLoadFactoryShortSyntax 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::testLoadFactoryShortSyntax()

File

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

Class

YamlFileLoaderTest

Namespace

Symfony\Component\DependencyInjection\Tests\Loader

Code

public function testLoadFactoryShortSyntax() {
  $container = new ContainerBuilder();
  $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml'));
  $loader
    ->load('services14.yml');
  $services = $container
    ->getDefinitions();
  $this
    ->assertEquals(array(
    new Reference('baz'),
    'getClass',
  ), $services['factory']
    ->getFactory(), '->load() parses the factory tag with service:method');
  $this
    ->assertEquals(array(
    'FooBacFactory',
    'createFooBar',
  ), $services['factory_with_static_call']
    ->getFactory(), '->load() parses the factory tag with Class::method');
}