You are here

public function ContainerTest::testAddScope in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Tests/ContainerTest.php \Symfony\Component\DependencyInjection\Tests\ContainerTest::testAddScope()

File

vendor/symfony/dependency-injection/Tests/ContainerTest.php, line 517

Class

ContainerTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testAddScope() {
  $c = new Container();
  $c
    ->addScope(new Scope('foo'));
  $c
    ->addScope(new Scope('bar', 'foo'));
  $this
    ->assertSame(array(
    'foo' => 'container',
    'bar' => 'foo',
  ), $this
    ->getField($c, 'scopes'));
  $this
    ->assertSame(array(
    'foo' => array(
      'bar',
    ),
    'bar' => array(),
  ), $this
    ->getField($c, 'scopeChildren'));
  $c
    ->addScope(new Scope('baz', 'bar'));
  $this
    ->assertSame(array(
    'foo' => 'container',
    'bar' => 'foo',
    'baz' => 'bar',
  ), $this
    ->getField($c, 'scopes'));
  $this
    ->assertSame(array(
    'foo' => array(
      'bar',
      'baz',
    ),
    'bar' => array(
      'baz',
    ),
    'baz' => array(),
  ), $this
    ->getField($c, 'scopeChildren'));
}