public function ContainerBuilderTest::testSetDefinition in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php \Drupal\Tests\Core\DependencyInjection\ContainerBuilderTest::testSetDefinition()
- 9 core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php \Drupal\Tests\Core\DependencyInjection\ContainerBuilderTest::testSetDefinition()
@covers ::setDefinition
File
- core/
tests/ Drupal/ Tests/ Core/ DependencyInjection/ ContainerBuilderTest.php, line 80
Class
- ContainerBuilderTest
- @coversDefaultClass \Drupal\Core\DependencyInjection\ContainerBuilder @group DependencyInjection
Namespace
Drupal\Tests\Core\DependencyInjectionCode
public function testSetDefinition() {
// Test a service with public set to true.
$container = new ContainerBuilder();
$definition = new Definition();
$definition
->setPublic(TRUE);
$service = $container
->setDefinition('foo', $definition);
$this
->assertTrue($service
->isPublic());
// Test a service with public set to false.
$definition = new Definition();
$definition
->setPublic(FALSE);
$service = $container
->setDefinition('foo', $definition);
$this
->assertFalse($service
->isPublic());
}