public function ContainerTest::testInitialized in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerTest.php \Symfony\Component\DependencyInjection\Tests\ContainerTest::testInitialized()
@covers Symfony\Component\DependencyInjection\Container::initialized
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ ContainerTest.php, line 301
Class
Namespace
Symfony\Component\DependencyInjection\TestsCode
public function testInitialized() {
$sc = new ProjectServiceContainer();
$sc
->set('foo', new \stdClass());
$this
->assertTrue($sc
->initialized('foo'), '->initialized() returns true if service is loaded');
$this
->assertFalse($sc
->initialized('foo1'), '->initialized() returns false if service is not loaded');
$this
->assertFalse($sc
->initialized('bar'), '->initialized() returns false if a service is defined, but not currently loaded');
$this
->assertFalse($sc
->initialized('alias'), '->initialized() returns false if an aliased service is not initialized');
$sc
->set('bar', new \stdClass());
$this
->assertTrue($sc
->initialized('alias'), '->initialized() returns true for alias if aliased service is initialized');
}