function 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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.