You are here

public function ContainerTest::testSetAlsoSetsScopedService 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::testSetAlsoSetsScopedService()

File

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

Class

ContainerTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testSetAlsoSetsScopedService() {
  $c = new Container();
  $c
    ->addScope(new Scope('foo'));
  $c
    ->enterScope('foo');
  $c
    ->set('foo', $foo = new \stdClass(), 'foo');
  $scoped = $this
    ->getField($c, 'scopedServices');
  $this
    ->assertTrue(isset($scoped['foo']['foo']), '->set() sets a scoped service');
  $this
    ->assertSame($foo, $scoped['foo']['foo'], '->set() sets a scoped service');
}