public function ContainerTest::testEnterChildScopeRecursively in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dependency-injection/Tests/ContainerTest.php \Symfony\Component\DependencyInjection\Tests\ContainerTest::testEnterChildScopeRecursively()
File
- vendor/
symfony/ dependency-injection/ Tests/ ContainerTest.php, line 410
Class
Namespace
Symfony\Component\DependencyInjection\TestsCode
public function testEnterChildScopeRecursively() {
$container = new Container();
$container
->addScope(new Scope('foo'));
$container
->addScope(new Scope('bar', 'foo'));
$container
->enterScope('foo');
$container
->enterScope('bar');
$this
->assertTrue($container
->isScopeActive('bar'));
$this
->assertFalse($container
->has('a'));
$a = new \stdClass();
$container
->set('a', $a, 'bar');
$scoped = $this
->getField($container, 'scopedServices');
$this
->assertTrue(isset($scoped['bar']['a']));
$this
->assertSame($a, $scoped['bar']['a']);
$this
->assertTrue($container
->has('a'));
$container
->enterScope('bar');
$scoped = $this
->getField($container, 'scopedServices');
$this
->assertFalse(isset($scoped['a']));
$this
->assertTrue($container
->isScopeActive('foo'));
$this
->assertTrue($container
->isScopeActive('bar'));
$this
->assertFalse($container
->has('a'));
$container
->leaveScope('bar');
$this
->assertTrue($container
->isScopeActive('foo'));
$this
->assertTrue($container
->isScopeActive('bar'));
$this
->assertTrue($container
->has('a'));
}