/** * @testdox Child container resolves parent's alias to parent's resource */ public function testChildResolveAlias() { $container = new Container(); $container->set('Joomla\\Tests\\Unit\\DI\\StubInterface', function () { return new Stub1(); }); $container->alias('stub', 'Joomla\\Tests\\Unit\\DI\\StubInterface'); $child = $container->createChild(); $this->assertInstanceOf('Joomla\\Tests\\Unit\\DI\\Stub1', $child->get('stub')); }
/** * Tests the creation of a child Container. * * @return void */ public function testCreateChild() { $child = $this->fixture->createChild(); $this->assertAttributeInstanceOf('Joomla\\DI\\Container', 'parent', $child, 'When creating a child container, the $parent property should be an instance of Joomla\\DI\\Container.'); $this->assertAttributeSame($this->fixture, 'parent', $child, 'When creating a child container, the $parent property should be the same as the creating Container.'); }