You are here

public function ContainerBuilderTest::testGet in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php \Drupal\Tests\Core\DependencyInjection\ContainerBuilderTest::testGet()
  2. 9 core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php \Drupal\Tests\Core\DependencyInjection\ContainerBuilderTest::testGet()

@covers ::get

File

core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php, line 19

Class

ContainerBuilderTest
@coversDefaultClass \Drupal\Core\DependencyInjection\ContainerBuilder @group DependencyInjection

Namespace

Drupal\Tests\Core\DependencyInjection

Code

public function testGet() {
  $container = new ContainerBuilder();
  $container
    ->register('bar', 'Drupal\\Tests\\Core\\DependencyInjection\\Fixture\\BarClass');
  $result = $container
    ->get('bar');
  $this
    ->assertInstanceOf(BarClass::class, $result);
}