You are here

public function ContainerBuilderTest::testPrivateServiceUser in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testPrivateServiceUser()

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php, line 679

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testPrivateServiceUser() {
  $fooDefinition = new Definition('BarClass');
  $fooUserDefinition = new Definition('BarUserClass', array(
    new Reference('bar'),
  ));
  $container = new ContainerBuilder();
  $container
    ->setResourceTracking(false);
  $fooDefinition
    ->setPublic(false);
  $container
    ->addDefinitions(array(
    'bar' => $fooDefinition,
    'bar_user' => $fooUserDefinition,
  ));
  $container
    ->compile();
  $this
    ->assertInstanceOf('BarClass', $container
    ->get('bar_user')->bar);
}