public function ContainerBuilderTest::testHas in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testHas()
@covers Symfony\Component\DependencyInjection\ContainerBuilder::has
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ ContainerBuilderTest.php, line 80
Class
Namespace
Symfony\Component\DependencyInjection\TestsCode
public function testHas() {
$builder = new ContainerBuilder();
$this
->assertFalse($builder
->has('foo'), '->has() returns false if the service does not exist');
$builder
->register('foo', 'Bar\\FooClass');
$this
->assertTrue($builder
->has('foo'), '->has() returns true if a service definition exists');
$builder
->set('bar', new \stdClass());
$this
->assertTrue($builder
->has('bar'), '->has() returns true if a service exists');
}