You are here

public function ContainerBuilderTest::testRegisterException 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::testRegisterException()
  2. 9 core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php \Drupal\Tests\Core\DependencyInjection\ContainerBuilderTest::testRegisterException()

@covers ::register

File

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

Class

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

Namespace

Drupal\Tests\Core\DependencyInjection

Code

public function testRegisterException() {
  $container = new ContainerBuilder();
  $this
    ->expectException(\InvalidArgumentException::class);
  $this
    ->expectExceptionMessage('Service ID names must be lowercase: Bar');
  $container
    ->register('Bar');
}