4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\DependencyInjection\Tests;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\DependencyInjection\Scope;
16 use Symfony\Component\DependencyInjection\Container;
17 use Symfony\Component\DependencyInjection\ContainerInterface;
18 use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
19 use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
21 class ContainerTest extends TestCase
23 public function testConstructor()
25 $sc = new Container();
26 $this->assertSame($sc, $sc->get('service_container'), '__construct() automatically registers itself as a service');
28 $sc = new Container(new ParameterBag(array('foo' => 'bar')));
29 $this->assertEquals(array('foo' => 'bar'), $sc->getParameterBag()->all(), '__construct() takes an array of parameters as its first argument');
33 * @dataProvider dataForTestCamelize
35 public function testCamelize($id, $expected)
37 $this->assertEquals($expected, Container::camelize($id), sprintf('Container::camelize("%s")', $id));
40 public function dataForTestCamelize()
43 array('foo_bar', 'FooBar'),
44 array('foo.bar', 'Foo_Bar'),
45 array('foo.bar_baz', 'Foo_BarBaz'),
46 array('foo._bar', 'Foo_Bar'),
47 array('foo_.bar', 'Foo_Bar'),
49 array('.foo', '_Foo'),
51 array('foo.', 'Foo_'),
52 array('foo\bar', 'Foo_Bar'),
57 * @dataProvider dataForTestUnderscore
59 public function testUnderscore($id, $expected)
61 $this->assertEquals($expected, Container::underscore($id), sprintf('Container::underscore("%s")', $id));
64 public function dataForTestUnderscore()
67 array('FooBar', 'foo_bar'),
68 array('Foo_Bar', 'foo.bar'),
69 array('Foo_BarBaz', 'foo.bar_baz'),
70 array('FooBar_BazQux', 'foo_bar.baz_qux'),
71 array('_Foo', '.foo'),
72 array('Foo_', 'foo.'),
76 public function testCompile()
78 $sc = new Container(new ParameterBag(array('foo' => 'bar')));
79 $this->assertFalse($sc->getParameterBag()->isResolved(), '->compile() resolves the parameter bag');
81 $this->assertTrue($sc->getParameterBag()->isResolved(), '->compile() resolves the parameter bag');
82 $this->assertInstanceOf('Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag', $sc->getParameterBag(), '->compile() changes the parameter bag to a FrozenParameterBag instance');
83 $this->assertEquals(array('foo' => 'bar'), $sc->getParameterBag()->all(), '->compile() copies the current parameters to the new parameter bag');
86 public function testIsFrozen()
88 $sc = new Container(new ParameterBag(array('foo' => 'bar')));
89 $this->assertFalse($sc->isFrozen(), '->isFrozen() returns false if the parameters are not frozen');
91 $this->assertTrue($sc->isFrozen(), '->isFrozen() returns true if the parameters are frozen');
94 public function testGetParameterBag()
96 $sc = new Container();
97 $this->assertEquals(array(), $sc->getParameterBag()->all(), '->getParameterBag() returns an empty array if no parameter has been defined');
100 public function testGetSetParameter()
102 $sc = new Container(new ParameterBag(array('foo' => 'bar')));
103 $sc->setParameter('bar', 'foo');
104 $this->assertEquals('foo', $sc->getParameter('bar'), '->setParameter() sets the value of a new parameter');
106 $sc->setParameter('foo', 'baz');
107 $this->assertEquals('baz', $sc->getParameter('foo'), '->setParameter() overrides previously set parameter');
109 $sc->setParameter('Foo', 'baz1');
110 $this->assertEquals('baz1', $sc->getParameter('foo'), '->setParameter() converts the key to lowercase');
111 $this->assertEquals('baz1', $sc->getParameter('FOO'), '->getParameter() converts the key to lowercase');
114 $sc->getParameter('baba');
115 $this->fail('->getParameter() thrown an \InvalidArgumentException if the key does not exist');
116 } catch (\Exception $e) {
117 $this->assertInstanceOf('\InvalidArgumentException', $e, '->getParameter() thrown an \InvalidArgumentException if the key does not exist');
118 $this->assertEquals('You have requested a non-existent parameter "baba".', $e->getMessage(), '->getParameter() thrown an \InvalidArgumentException if the key does not exist');
122 public function testGetServiceIds()
124 $sc = new Container();
125 $sc->set('foo', $obj = new \stdClass());
126 $sc->set('bar', $obj = new \stdClass());
127 $this->assertEquals(array('service_container', 'foo', 'bar'), $sc->getServiceIds(), '->getServiceIds() returns all defined service ids');
129 $sc = new ProjectServiceContainer();
130 $sc->set('foo', $obj = new \stdClass());
131 $this->assertEquals(array('scoped', 'scoped_foo', 'scoped_synchronized_foo', 'inactive', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'service_container', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by getXXXService() methods, followed by service ids defined by set()');
134 public function testSet()
136 $sc = new Container();
137 $sc->set('foo', $foo = new \stdClass());
138 $this->assertSame($foo, $sc->get('foo'), '->set() sets a service');
141 public function testSetWithNullResetTheService()
143 $sc = new Container();
144 $sc->set('foo', null);
145 $this->assertFalse($sc->has('foo'), '->set() with null service resets the service');
149 * @expectedException \InvalidArgumentException
152 public function testSetDoesNotAllowPrototypeScope()
154 $c = new Container();
155 $c->set('foo', new \stdClass(), Container::SCOPE_PROTOTYPE);
159 * @expectedException \RuntimeException
162 public function testSetDoesNotAllowInactiveScope()
164 $c = new Container();
165 $c->addScope(new Scope('foo'));
166 $c->set('foo', new \stdClass(), 'foo');
172 public function testSetAlsoSetsScopedService()
174 $c = new Container();
175 $c->addScope(new Scope('foo'));
176 $c->enterScope('foo');
177 $c->set('foo', $foo = new \stdClass(), 'foo');
179 $scoped = $this->getField($c, 'scopedServices');
180 $this->assertTrue(isset($scoped['foo']['foo']), '->set() sets a scoped service');
181 $this->assertSame($foo, $scoped['foo']['foo'], '->set() sets a scoped service');
187 public function testSetAlsoCallsSynchronizeService()
189 $c = new ProjectServiceContainer();
190 $c->addScope(new Scope('foo'));
191 $c->enterScope('foo');
192 $c->set('scoped_synchronized_foo', $bar = new \stdClass(), 'foo');
193 $this->assertTrue($c->synchronized, '->set() calls synchronize*Service() if it is defined for the service');
196 public function testSetReplacesAlias()
198 $c = new ProjectServiceContainer();
200 $c->set('alias', $foo = new \stdClass());
201 $this->assertSame($foo, $c->get('alias'), '->set() replaces an existing alias');
204 public function testGet()
206 $sc = new ProjectServiceContainer();
207 $sc->set('foo', $foo = new \stdClass());
208 $this->assertSame($foo, $sc->get('foo'), '->get() returns the service for the given id');
209 $this->assertSame($foo, $sc->get('Foo'), '->get() returns the service for the given id, and converts id to lowercase');
210 $this->assertSame($sc->__bar, $sc->get('bar'), '->get() returns the service for the given id');
211 $this->assertSame($sc->__foo_bar, $sc->get('foo_bar'), '->get() returns the service if a get*Method() is defined');
212 $this->assertSame($sc->__foo_baz, $sc->get('foo.baz'), '->get() returns the service if a get*Method() is defined');
213 $this->assertSame($sc->__foo_baz, $sc->get('foo\\baz'), '->get() returns the service if a get*Method() is defined');
215 $sc->set('bar', $bar = new \stdClass());
216 $this->assertSame($bar, $sc->get('bar'), '->get() prefers to return a service defined with set() than one defined with a getXXXMethod()');
220 $this->fail('->get() throws a \InvalidArgumentException exception if the service is empty');
221 } catch (\Exception $e) {
222 $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException', $e, '->get() throws a ServiceNotFoundException exception if the service is empty');
224 $this->assertNull($sc->get('', ContainerInterface::NULL_ON_INVALID_REFERENCE), '->get() returns null if the service is empty');
227 public function testGetThrowServiceNotFoundException()
229 $sc = new ProjectServiceContainer();
230 $sc->set('foo', $foo = new \stdClass());
231 $sc->set('baz', $foo = new \stdClass());
235 $this->fail('->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException if the key does not exist');
236 } catch (\Exception $e) {
237 $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException', $e, '->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException if the key does not exist');
238 $this->assertEquals('You have requested a non-existent service "foo1". Did you mean this: "foo"?', $e->getMessage(), '->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException with some advices');
243 $this->fail('->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException if the key does not exist');
244 } catch (\Exception $e) {
245 $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException', $e, '->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException if the key does not exist');
246 $this->assertEquals('You have requested a non-existent service "bag". Did you mean one of these: "bar", "baz"?', $e->getMessage(), '->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException with some advices');
250 public function testGetCircularReference()
252 $sc = new ProjectServiceContainer();
254 $sc->get('circular');
255 $this->fail('->get() throws a ServiceCircularReferenceException if it contains circular reference');
256 } catch (\Exception $e) {
257 $this->assertInstanceOf('\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException', $e, '->get() throws a ServiceCircularReferenceException if it contains circular reference');
258 $this->assertStringStartsWith('Circular reference detected for service "circular"', $e->getMessage(), '->get() throws a \LogicException if it contains circular reference');
265 public function testGetReturnsNullOnInactiveScope()
267 $sc = new ProjectServiceContainer();
268 $this->assertNull($sc->get('inactive', ContainerInterface::NULL_ON_INVALID_REFERENCE));
272 * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
273 * @expectedExceptionMessage You have requested a synthetic service ("request"). The DIC does not know how to construct this service.
275 public function testGetSyntheticServiceAlwaysThrows()
277 require_once __DIR__.'/Fixtures/php/services9.php';
279 $container = new \ProjectServiceContainer();
280 $container->get('request', ContainerInterface::NULL_ON_INVALID_REFERENCE);
283 public function testHas()
285 $sc = new ProjectServiceContainer();
286 $sc->set('foo', new \stdClass());
287 $this->assertFalse($sc->has('foo1'), '->has() returns false if the service does not exist');
288 $this->assertTrue($sc->has('foo'), '->has() returns true if the service exists');
289 $this->assertTrue($sc->has('bar'), '->has() returns true if a get*Method() is defined');
290 $this->assertTrue($sc->has('foo_bar'), '->has() returns true if a get*Method() is defined');
291 $this->assertTrue($sc->has('foo.baz'), '->has() returns true if a get*Method() is defined');
292 $this->assertTrue($sc->has('foo\\baz'), '->has() returns true if a get*Method() is defined');
295 public function testInitialized()
297 $sc = new ProjectServiceContainer();
298 $sc->set('foo', new \stdClass());
299 $this->assertTrue($sc->initialized('foo'), '->initialized() returns true if service is loaded');
300 $this->assertFalse($sc->initialized('foo1'), '->initialized() returns false if service is not loaded');
301 $this->assertFalse($sc->initialized('bar'), '->initialized() returns false if a service is defined, but not currently loaded');
302 $this->assertFalse($sc->initialized('alias'), '->initialized() returns false if an aliased service is not initialized');
304 $sc->set('bar', new \stdClass());
305 $this->assertTrue($sc->initialized('alias'), '->initialized() returns true for alias if aliased service is initialized');
308 public function testReset()
310 $c = new Container();
311 $c->set('bar', new \stdClass());
315 $this->assertNull($c->get('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE));
319 * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
320 * @expectedExceptionMessage Resetting the container is not allowed when a scope is active.
323 public function testCannotResetInActiveScope()
325 $c = new Container();
326 $c->addScope(new Scope('foo'));
327 $c->set('bar', new \stdClass());
329 $c->enterScope('foo');
337 public function testResetAfterLeavingScope()
339 $c = new Container();
340 $c->addScope(new Scope('foo'));
341 $c->set('bar', new \stdClass());
343 $c->enterScope('foo');
344 $c->leaveScope('foo');
348 $this->assertNull($c->get('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE));
354 public function testEnterLeaveCurrentScope()
356 $container = new ProjectServiceContainer();
357 $container->addScope(new Scope('foo'));
359 $container->enterScope('foo');
360 $container->set('foo', new \stdClass(), 'foo');
361 $scoped1 = $container->get('scoped');
362 $scopedFoo1 = $container->get('scoped_foo');
364 $container->enterScope('foo');
365 $container->set('foo', new \stdClass(), 'foo');
366 $scoped2 = $container->get('scoped');
367 $scoped3 = $container->get('SCOPED');
368 $scopedFoo2 = $container->get('scoped_foo');
370 $container->set('foo', null, 'foo');
371 $container->leaveScope('foo');
372 $scoped4 = $container->get('scoped');
373 $scopedFoo3 = $container->get('scoped_foo');
375 $this->assertNotSame($scoped1, $scoped2);
376 $this->assertSame($scoped2, $scoped3);
377 $this->assertSame($scoped1, $scoped4);
378 $this->assertNotSame($scopedFoo1, $scopedFoo2);
379 $this->assertSame($scopedFoo1, $scopedFoo3);
385 public function testEnterLeaveScopeWithChildScopes()
387 $container = new Container();
388 $container->addScope(new Scope('foo'));
389 $container->addScope(new Scope('bar', 'foo'));
391 $this->assertFalse($container->isScopeActive('foo'));
393 $container->enterScope('foo');
394 $container->enterScope('bar');
396 $this->assertTrue($container->isScopeActive('foo'));
397 $this->assertFalse($container->has('a'));
399 $a = new \stdClass();
400 $container->set('a', $a, 'bar');
402 $scoped = $this->getField($container, 'scopedServices');
403 $this->assertTrue(isset($scoped['bar']['a']));
404 $this->assertSame($a, $scoped['bar']['a']);
405 $this->assertTrue($container->has('a'));
407 $container->leaveScope('foo');
409 $scoped = $this->getField($container, 'scopedServices');
410 $this->assertFalse(isset($scoped['bar']));
411 $this->assertFalse($container->isScopeActive('foo'));
412 $this->assertFalse($container->has('a'));
418 public function testEnterScopeRecursivelyWithInactiveChildScopes()
420 $container = new Container();
421 $container->addScope(new Scope('foo'));
422 $container->addScope(new Scope('bar', 'foo'));
424 $this->assertFalse($container->isScopeActive('foo'));
426 $container->enterScope('foo');
428 $this->assertTrue($container->isScopeActive('foo'));
429 $this->assertFalse($container->isScopeActive('bar'));
430 $this->assertFalse($container->has('a'));
432 $a = new \stdClass();
433 $container->set('a', $a, 'foo');
435 $scoped = $this->getField($container, 'scopedServices');
436 $this->assertTrue(isset($scoped['foo']['a']));
437 $this->assertSame($a, $scoped['foo']['a']);
438 $this->assertTrue($container->has('a'));
440 $container->enterScope('foo');
442 $scoped = $this->getField($container, 'scopedServices');
443 $this->assertFalse(isset($scoped['a']));
444 $this->assertTrue($container->isScopeActive('foo'));
445 $this->assertFalse($container->isScopeActive('bar'));
446 $this->assertFalse($container->has('a'));
448 $container->enterScope('bar');
450 $this->assertTrue($container->isScopeActive('bar'));
452 $container->leaveScope('foo');
454 $this->assertTrue($container->isScopeActive('foo'));
455 $this->assertFalse($container->isScopeActive('bar'));
456 $this->assertTrue($container->has('a'));
462 public function testEnterChildScopeRecursively()
464 $container = new Container();
465 $container->addScope(new Scope('foo'));
466 $container->addScope(new Scope('bar', 'foo'));
468 $container->enterScope('foo');
469 $container->enterScope('bar');
471 $this->assertTrue($container->isScopeActive('bar'));
472 $this->assertFalse($container->has('a'));
474 $a = new \stdClass();
475 $container->set('a', $a, 'bar');
477 $scoped = $this->getField($container, 'scopedServices');
478 $this->assertTrue(isset($scoped['bar']['a']));
479 $this->assertSame($a, $scoped['bar']['a']);
480 $this->assertTrue($container->has('a'));
482 $container->enterScope('bar');
484 $scoped = $this->getField($container, 'scopedServices');
485 $this->assertFalse(isset($scoped['a']));
486 $this->assertTrue($container->isScopeActive('foo'));
487 $this->assertTrue($container->isScopeActive('bar'));
488 $this->assertFalse($container->has('a'));
490 $container->leaveScope('bar');
492 $this->assertTrue($container->isScopeActive('foo'));
493 $this->assertTrue($container->isScopeActive('bar'));
494 $this->assertTrue($container->has('a'));
498 * @expectedException \InvalidArgumentException
501 public function testEnterScopeNotAdded()
503 $container = new Container();
504 $container->enterScope('foo');
508 * @expectedException \RuntimeException
511 public function testEnterScopeDoesNotAllowInactiveParentScope()
513 $container = new Container();
514 $container->addScope(new Scope('foo'));
515 $container->addScope(new Scope('bar', 'foo'));
516 $container->enterScope('bar');
522 public function testLeaveScopeNotActive()
524 $container = new Container();
525 $container->addScope(new Scope('foo'));
528 $container->leaveScope('foo');
529 $this->fail('->leaveScope() throws a \LogicException if the scope is not active yet');
530 } catch (\Exception $e) {
531 $this->assertInstanceOf('\LogicException', $e, '->leaveScope() throws a \LogicException if the scope is not active yet');
532 $this->assertEquals('The scope "foo" is not active.', $e->getMessage(), '->leaveScope() throws a \LogicException if the scope is not active yet');
536 $container->leaveScope('bar');
537 $this->fail('->leaveScope() throws a \LogicException if the scope does not exist');
538 } catch (\Exception $e) {
539 $this->assertInstanceOf('\LogicException', $e, '->leaveScope() throws a \LogicException if the scope does not exist');
540 $this->assertEquals('The scope "bar" is not active.', $e->getMessage(), '->leaveScope() throws a \LogicException if the scope does not exist');
545 * @expectedException \InvalidArgumentException
546 * @dataProvider getLegacyBuiltInScopes
549 public function testAddScopeDoesNotAllowBuiltInScopes($scope)
551 $container = new Container();
552 $container->addScope(new Scope($scope));
556 * @expectedException \InvalidArgumentException
559 public function testAddScopeDoesNotAllowExistingScope()
561 $container = new Container();
562 $container->addScope(new Scope('foo'));
563 $container->addScope(new Scope('foo'));
567 * @expectedException \InvalidArgumentException
568 * @dataProvider getLegacyInvalidParentScopes
571 public function testAddScopeDoesNotAllowInvalidParentScope($scope)
573 $c = new Container();
574 $c->addScope(new Scope('foo', $scope));
580 public function testAddScope()
582 $c = new Container();
583 $c->addScope(new Scope('foo'));
584 $c->addScope(new Scope('bar', 'foo'));
586 $this->assertSame(array('foo' => 'container', 'bar' => 'foo'), $this->getField($c, 'scopes'));
587 $this->assertSame(array('foo' => array('bar'), 'bar' => array()), $this->getField($c, 'scopeChildren'));
589 $c->addScope(new Scope('baz', 'bar'));
591 $this->assertSame(array('foo' => 'container', 'bar' => 'foo', 'baz' => 'bar'), $this->getField($c, 'scopes'));
592 $this->assertSame(array('foo' => array('bar', 'baz'), 'bar' => array('baz'), 'baz' => array()), $this->getField($c, 'scopeChildren'));
598 public function testHasScope()
600 $c = new Container();
602 $this->assertFalse($c->hasScope('foo'));
603 $c->addScope(new Scope('foo'));
604 $this->assertTrue($c->hasScope('foo'));
608 * @expectedException \Exception
609 * @expectedExceptionMessage Something went terribly wrong!
611 public function testGetThrowsException()
613 $c = new ProjectServiceContainer();
616 $c->get('throw_exception');
617 } catch (\Exception $e) {
621 // Retry, to make sure that get*Service() will be called.
622 $c->get('throw_exception');
625 public function testGetThrowsExceptionOnServiceConfiguration()
627 $c = new ProjectServiceContainer();
630 $c->get('throws_exception_on_service_configuration');
631 } catch (\Exception $e) {
635 $this->assertFalse($c->initialized('throws_exception_on_service_configuration'));
637 // Retry, to make sure that get*Service() will be called.
639 $c->get('throws_exception_on_service_configuration');
640 } catch (\Exception $e) {
643 $this->assertFalse($c->initialized('throws_exception_on_service_configuration'));
649 public function testIsScopeActive()
651 $c = new Container();
653 $this->assertFalse($c->isScopeActive('foo'));
654 $c->addScope(new Scope('foo'));
656 $this->assertFalse($c->isScopeActive('foo'));
657 $c->enterScope('foo');
659 $this->assertTrue($c->isScopeActive('foo'));
660 $c->leaveScope('foo');
662 $this->assertFalse($c->isScopeActive('foo'));
665 public function getLegacyInvalidParentScopes()
668 array(ContainerInterface::SCOPE_PROTOTYPE),
673 public function getLegacyBuiltInScopes()
676 array(ContainerInterface::SCOPE_CONTAINER),
677 array(ContainerInterface::SCOPE_PROTOTYPE),
681 protected function getField($obj, $field)
683 $reflection = new \ReflectionProperty($obj, $field);
684 $reflection->setAccessible(true);
686 return $reflection->getValue($obj);
689 public function testAlias()
691 $c = new ProjectServiceContainer();
693 $this->assertTrue($c->has('alias'));
694 $this->assertSame($c->get('alias'), $c->get('bar'));
697 public function testThatCloningIsNotSupported()
699 $class = new \ReflectionClass('Symfony\Component\DependencyInjection\Container');
700 $clone = $class->getMethod('__clone');
701 if (\PHP_VERSION_ID >= 50400) {
702 $this->assertFalse($class->isCloneable());
704 $this->assertTrue($clone->isPrivate());
708 class ProjectServiceContainer extends Container
713 public $synchronized;
715 public function __construct()
717 parent::__construct();
719 $this->__bar = new \stdClass();
720 $this->__foo_bar = new \stdClass();
721 $this->__foo_baz = new \stdClass();
722 $this->synchronized = false;
723 $this->aliases = array('alias' => 'bar');
726 protected function getScopedService()
728 if (!$this->isScopeActive('foo')) {
729 throw new \RuntimeException('Invalid call');
732 return $this->services['scoped'] = $this->scopedServices['foo']['scoped'] = new \stdClass();
735 protected function getScopedFooService()
737 if (!$this->isScopeActive('foo')) {
738 throw new \RuntimeException('invalid call');
741 return $this->services['scoped_foo'] = $this->scopedServices['foo']['scoped_foo'] = new \stdClass();
744 protected function getScopedSynchronizedFooService()
746 if (!$this->isScopeActive('foo')) {
747 throw new \RuntimeException('invalid call');
750 return $this->services['scoped_bar'] = $this->scopedServices['foo']['scoped_bar'] = new \stdClass();
753 protected function synchronizeFooService()
755 // Typically get the service to pass it to a setter
759 protected function synchronizeScopedSynchronizedFooService()
761 $this->synchronized = true;
764 protected function getInactiveService()
766 throw new InactiveScopeException('request', 'request');
769 protected function getBarService()
774 protected function getFooBarService()
776 return $this->__foo_bar;
779 protected function getFoo_BazService()
781 return $this->__foo_baz;
784 protected function getCircularService()
786 return $this->get('circular');
789 protected function getThrowExceptionService()
791 throw new \Exception('Something went terribly wrong!');
794 protected function getThrowsExceptionOnServiceConfigurationService()
796 $this->services['throws_exception_on_service_configuration'] = $instance = new \stdClass();
798 throw new \Exception('Something was terribly wrong while trying to configure the service!');