You are here

public function ContainerBuilderTest::testExtension in Service Container 7

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

@covers Symfony\Component\DependencyInjection\ContainerBuilder::registerExtension @covers Symfony\Component\DependencyInjection\ContainerBuilder::getExtension

File

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

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testExtension() {
  $container = new ContainerBuilder();
  $container
    ->setResourceTracking(false);
  $container
    ->registerExtension($extension = new \ProjectExtension());
  $this
    ->assertTrue($container
    ->getExtension('project') === $extension, '->registerExtension() registers an extension');
  $this
    ->setExpectedException('LogicException');
  $container
    ->getExtension('no_registered');
}