You are here

public function ContainerBuilderTest::testRegister in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testRegister()

@covers Symfony\Component\DependencyInjection\ContainerBuilder::register

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php, line 69

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testRegister() {
  $builder = new ContainerBuilder();
  $builder
    ->register('foo', 'Bar\\FooClass');
  $this
    ->assertTrue($builder
    ->hasDefinition('foo'), '->register() registers a new service definition');
  $this
    ->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $builder
    ->getDefinition('foo'), '->register() returns the newly created Definition instance');
}