You are here

public function PhpDumperTest::testCircularReference in Service Container 7

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

@expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php, line 212

Class

PhpDumperTest

Namespace

Symfony\Component\DependencyInjection\Tests\Dumper

Code

public function testCircularReference() {
  $container = new ContainerBuilder();
  $container
    ->register('foo', 'stdClass')
    ->addArgument(new Reference('bar'));
  $container
    ->register('bar', 'stdClass')
    ->setPublic(false)
    ->addMethodCall('setA', array(
    new Reference('baz'),
  ));
  $container
    ->register('baz', 'stdClass')
    ->addMethodCall('setA', array(
    new Reference('foo'),
  ));
  $container
    ->compile();
  $dumper = new PhpDumper($container);
  $dumper
    ->dump();
}